Skip to content

Commit

Permalink
feat: table-col-sort-button: opt-in to prefer-fixed-positioning for d…
Browse files Browse the repository at this point in the history
…ropdown (#5338)

* feat: table-col-sort-button: opt-in to prefer-fixed-positioning for dropdown

* add comment about flag in demo pages

* Updating vdiff goldens (#5339)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
margaree and github-actions[bot] authored Jan 22, 2025
1 parent 8afcb5a commit 3d13249
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/filter/demo/filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import './filter-load-more-demo.js';
</script>
<script>
window.D2L = { LP: { Web: { UI: { Flags: { Flag: () => true } } } } };
window.D2L = { LP: { Web: { UI: { Flags: { Flag: () => true } } } } }; // TODO: remove with GAUD-131-dropdown-fixed-positioning flag clean up
</script>
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1.0">
<meta charset="UTF-8">
Expand Down
3 changes: 3 additions & 0 deletions components/table/demo/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import '../../demo/demo-page.js';
import './table-test.js';
</script>
<script>
window.D2L = { LP: { Web: { UI: { Flags: { Flag: () => true } } } } }; // TODO: remove with GAUD-131-dropdown-fixed-positioning flag clean up
</script>
</head>
<body unresolved>

Expand Down
4 changes: 2 additions & 2 deletions components/table/table-col-sort-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
<slot></slot>${iconView}
</button><span id="${this._describedById}" hidden>${buttonDescription}</span>${sortedView}`;
if (this._hasDropdownItems) {
return html`<d2l-dropdown>
return html`<d2l-dropdown prefer-fixed-positioning>
${button}
<d2l-dropdown-menu no-pointer align="start" vertical-offset="0">
<d2l-dropdown-menu no-pointer align="start" vertical-offset="0" prefer-fixed-positioning>
<d2l-menu @d2l-table-col-sort-button-item-change="${this._handleTablColSortButtonItemChange}">
<slot name="items" @slotchange="${this._handleSlotChange}"></slot>
</d2l-menu>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions components/table/test/table.vdiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,26 @@ describe('table', () => {
await expect(elem).to.be.golden();
});

it('col-sort-button-dropdown-open-short-flag-off', async() => {
window.D2L = {};
const elem = await createTableFixture(html`
<thead>${createSortableButtonDropdownHeaderRow()}</thead>
<tbody>${createRows([1])}</tbody>
`);
await clickElem(elem.shadowRoot.querySelector('d2l-table-col-sort-button'));
await expect(elem).to.be.golden();
});

it('col-sort-button-dropdown-open-short-flag-on', async() => {
window.D2L = { LP: { Web: { UI: { Flags: { Flag: () => true } } } } };
const elem = await createTableFixture(html`
<thead>${createSortableButtonDropdownHeaderRow()}</thead>
<tbody>${createRows([1])}</tbody>
`);
await clickElem(elem.shadowRoot.querySelector('d2l-table-col-sort-button'));
await expect(elem).to.be.golden({ margin: 50 });
});

it('wrapper component', async() => {
const elem = await fixture(html`<d2l-test-table type="${type}"></d2l-test-table>`, { rtl });
await expect(elem).to.be.golden();
Expand Down

0 comments on commit 3d13249

Please sign in to comment.