Skip to content

Popover component not appearing #2393

@ArakTaiRoth

Description

@ArakTaiRoth

Issue reported by: fahad.mahmood@gov.ab.ca@gov.ab.ca
Web component version: 1.29.0
Angular/React version: Angular 3.2.0

Info

At smaller resolutions, a popover contained in a table will not actually appear when it should. The important part in the code below is [relative]="true". When that is supplied on the popover, the issue comes up, if it's removed there's no issue.

This can be replicated with the following code in Angular:

interface User {
  id: string;
  firstName: string;
  lastName: string;
  age: number;
}

export class TableComponent {
  users: User[] = [];

  constructor() {
    this.users = [
      {
        firstName: "Christian",
        lastName: "Batz",
        age: 18,
      },
      {
        firstName: "Brain",
        lastName: "Wisozk",
        age: 19,
      },
      {
        firstName: "Neha",
        lastName: "Jones",
        age: 23,
      },
      {
        firstName: "Tristin",
        lastName: "Buckridge",
        age: 31,
      },
    ];
  }

  handleSort(event: any) {
    const {sortBy, sortDir} = event.detail;
    this.users.sort(
      (a: any, b: any) => (a[sortBy] > b[sortBy] ? 1 : -1) * sortDir
    );
  }
}
<goa-table width="100%" mb="xl" (_sort)="handleSort($event)">
  <thead>
    <tr>
      <th>
        <goa-table-sort-header name="firstName"
          >First name and really long header</goa-table-sort-header
        >
      </th>
      <th>Another really long header</th>
      <th>Age</th>
      <th>Random Column 1</th>
      <th>Random Column 2</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let user of users; index as i">
      <td>{{ user.firstName }}</td>
      <td>{{ user.lastName }}</td>
      <td>{{ user.age }}</td>
      <td>
        <goa-popover [relative]="true">
          <p>This is a popover</p>
          It can be used for a number of different contexts.
          <div slot="target">
            <goa-button type="secondary" size="compact">Click me</goa-button>
          </div>
        </goa-popover>
      </td>
      <td>
        <goa-popover [relative]="true">
          <p>This is a popover</p>
          It can be used for a number of different contexts.
          <div slot="target">
            <goa-button type="secondary" size="compact">Click me</goa-button>
          </div>
        </goa-popover>
      </td>
    </tr>
  </tbody>
</goa-table>

Jam.dev link

https://jam.dev/c/05e661cc-7059-42f6-90ec-d2fb2e85215b

Acceptance Criteria

  1. If the relative property is supplied on the Popover component, the popover should open regardless of screen real estate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions