Repository navigation
DataViews: Render table bulk actions outside the table - #85250
dinhtungdu wants to merge 9 commits into
Conversation
Keep the toolbar over the sticky header without adding a table row or cell. Measure the header with the existing resize observer so density and custom header sizes stay aligned. Amp-Thread-ID: https://ampcode.com/threads/T-01a1590a-46c4-73eb-a596-5d55213f3f75 Co-authored-by: Amp <amp@ampcode.com>
Fade the toolbar over a themed backing so covered column headers cannot show through. Extend delayed-loading browser coverage. Amp-Thread-ID: https://ampcode.com/threads/T-01a1590a-46c4-73eb-a596-5d55213f3f75 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1590a-46c4-73eb-a596-5d55213f3f75 Co-authored-by: Amp <amp@ampcode.com>
Preserve both unreleased DataViews changelog entries. Amp-Thread-ID: https://ampcode.com/threads/T-01a1590a-46c4-73eb-a596-5d55213f3f75 Co-authored-by: Amp <amp@ampcode.com>
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the |
Cover fractional scroll bounds, locate bulk actions outside table cells, and link the changelog to this PR. Amp-Thread-ID: https://ampcode.com/threads/T-01a1590a-46c4-73eb-a596-5d55213f3f75 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1590a-46c4-73eb-a596-5d55213f3f75 Co-authored-by: Amp <amp@ampcode.com>
The header height lived in React state seeded with 52px and updated from the resize observer, which reports after the first paint. Toolbars shown on mount (such as a selection restored from the URL) rendered at 52px for a frame in every density. Measure the header in a layout effect when the toolbar shows, and write the height to the overlay directly from the observer so header resizes no longer re-render the table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The toolbar now sits outside the table, so a sticky offset that consumers give the header no longer moved it: it stayed at the top of the scroll area while the header sat lower. Copy the header's computed inset-block-start onto the toolbar when it is placed. Its z-index of 2 also lifted it above page elements at z-index 2 (such as a sticky heading), which the header-contained toolbar stayed under. Isolate the table so the header's z-index stays inside it, and drop the toolbar back to z-index 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The story offset the sticky table header by 67px to clear its sticky heading, but the header sticks inside the layout's own scroll area, which never scrolls in this story. The header never stuck to the page and instead sat 67px down, covering the first row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@dinhtungdu Thanks, moving the toolbar out of the table is a nice cleanup. While testing it, I found three issues with the sibling placement and pushed fixes for you to look at (feel free to revert them):
I also fixed the Free Composition story, which is broken on trunk too: its sticky header offset never worked and just hid the first row. Fixed in f571a2c. |
| const bulkActions = table.getByRole( 'cell', { | ||
| name: /items selected/, | ||
| } ); | ||
| const bulkActions = page.locator( '.dataviews-bulk-actions' ); |
There was a problem hiding this comment.
I think we'd generally prefer roles over classes, to avoid churning e2e test. Can we get this by role somehow?
| ) } | ||
| ref={ bulkActionsRef } | ||
| hidden={ ! showBulkActions } | ||
| inert={ inertValue( !! isLoading ) } |
There was a problem hiding this comment.
If the element is inert while loading, do we also need aria-busy?
| expect( toolbar.getBoundingClientRect().width ).toBe( | ||
| scroller.clientWidth | ||
| ); |
There was a problem hiding this comment.
We could make this test more robust by allowing some margin here. How about:
| expect( toolbar.getBoundingClientRect().width ).toBe( | |
| scroller.clientWidth | |
| ); | |
| expect( | |
| Math.abs( | |
| toolbar.getBoundingClientRect().width - scroller.clientWidth | |
| ) | |
| ).toBeLessThanOrEqual( 0.5 ); |
|
This looks good and I'd approve. Though I want to hear your thoughts first about my suggestions (feel free to revert). |
What?
Follow-up to #82730. Move the table bulk actions toolbar outside the table while preserving its placement over the column headers. No intended visual change.
Why?
Remove the workaround that places the bulk actions toolbar in an extra table row and restore the expected table structure.
How?
Use a sticky sibling element and measure the header height with a resize observer.
Testing Instructions
Testing Instructions for Keyboard
Tab to Select all and press Space. Focus moves to the toolbar checkbox. Tab through actions, then activate Cancel. Focus returns to Select all, and column sorting works again.
Use of AI Tools
Amp assisted with implementation, verification, and review.
Amp thread