Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});
Comment on lines +667 to +675
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not totally necessary, though it shows the problem. Would eventually get removed.


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
Loading