Repository navigation
Conversation
…crolled Tables without actions get a sticky overlay that fades the trailing edge of the visible area. Tables with actions fade the columns scrolling under the sticky actions column, in each cell's own background so selected rows keep their color. The scroll state is now tracked for every table, measured again when the table or its container resizes (not only on window resize), and the scroll-end check now works in RTL, where it previously reported the start of the scroll range as the end.
🤖 PR meta 🤖👋 Welcome👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @yaman-694! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. 🎉 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
Table cells don't wrap their text, so a long description or caption ran past its column and overlapped the next one. Both fields now truncate with an ellipsis in the table layout, like the filename field, and keep the full text in the DOM.
Size the scroll fade from a ref effect that observes its scroll container, so a fade that mounts after the first render (when actions become empty) gets its height. Inherit the background and mask it, like the sticky actions column, so the fade matches the surface a consumer sets, and place it with logical properties so it sits on the inline-end edge in RTL. Track the container and the table with a single ResizeObserver in useScrollState, which now only reports scroll state. Drop the hand-written CHANGELOG entries, and extend the browser tests to cover the late-mounting fade, the inherited color and the RTL position.
…e sticky actions divider in RTL
|
@mattmiklic has been exploring something similar for wp-admin, we should align on the approach (which I believe this PR already does). |
|
I just came across this pr from the issue and asked design over there on the way forward. I'd like to clarify that before discussing implementation. |
|
Thanks for the pr @yaman-694 I've prepared an alternate pr that uses a CSS only approach and deals with tables without actions (following suit on wp-admin approach). Would you mind consolidating over there? |
|
Sure @oandregal I will migrate my changes to your PR. |
|
#86829 is ready and I'll merge soon. Thanks for trying this, Yaman. |
What?
Closes #85898
Fades the trailing edge of a DataViews table while there are more columns to scroll to, and hides the fade at the end of the scroll range.
Why?
When a table is wider than its container, the trailing edge is a hard cut, so the table looks complete when it isn't. Tables without actions have no cue at all, and the existing divider on the sticky actions column was missing in RTL and could go stale.
How?
::beforeon the sticky actions cells, shown with the existing--stuckclass. It inherits each cell's own background and is masked to a gradient, so selected rows keep their tint.rtlcssdoesn't flipmask-image, so the RTL value is set with an/*rtl:...*/directive.useScrollState:useResizeObserver, instead of only onwindowresize. Before, adding columns from the view options didn't update the cue until the next scroll.Math.abs( scrollLeft )in both directions. In RTL,scrollLeft <= 1reported the start of the scroll range as the end, so the actions divider was missing until you scrolled.The overlay is
aria-hiddenand haspointer-events: none. Nothing changes in the accessibility tree or for focus.Testing Instructions
npm run storybook:devand open DataViews > DataViews > Layout Table.npm run test:unit:vitest -- packages/dataviews/src/dataviews/test/table-scroll-fade.browser.test.tsxto cover the table without actions, adding columns without scrolling, RTL, and the actions column.Testing Instructions for Keyboard
Screenshots or screencast
Use of AI Tools