DataViews: Add scrollY layout option for table views#76091
DataViews: Add scrollY layout option for table views#76091dilirity wants to merge 6 commits intoWordPress:trunkfrom
Conversation
Introduce a `scrollY` layout property for table and pickerTable views that controls where vertical scrolling occurs. When set to `'table'`, the table body scrolls independently while filters and actions remain fixed at the top. Horizontal scroll detection is also delegated to the inner scroll container so the sticky actions column border appears correctly.
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If 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. |
|
|
|
Would you be able to use free form instead to have this kind of interaction? Examples: free composition, minimal UI. |
free form doesn't solve this on its own - I've included a storybook ( |
|
I opened an alternative PR #76453 |
What?
Adds a new
scrollYlayout option to the DataViews table and pickerTable view types.CleanShot.2026-03-10.at.11.18.23.mp4
CleanShot.2026-03-10.at.11.17.03.mp4
Why?
Currently, the entire DataViews wrapper scrolls as one unit. When using free composition to build custom layouts - for example, with route tabs and view actions in a shared toolbar above the table - the table body needs to scroll independently within a constrained container while keeping the toolbar and table headers fixed.
Free composition gives control over the layout of the surrounding UI, but the table itself still needs to know where vertical scrolling should occur. Without this option, the only way to achieve this behavior is to override internal DataViews styles, which is fragile and breaks the sticky actions column border logic.
Additionally, the horizontal scroll needs to be handled by the correct container so the sticky actions column shows its border only when overlapping content.
How?
scrollY?: 'wrapper' | 'table'to theViewTableandViewPickerTablelayout types. Defaults to'wrapper'(current behavior).scrollYis'table', the wrapper disables vertical overflow (overflow-y: hidden) and the table is wrapped in an inner scroll container that handles both vertical and horizontal scrolling.scrollContainerRefis threaded throughDataViewsContextso the table component can expose the inner scroll element to the parent for infinite scroll support and horizontal scroll-end detection.DataViewsandDataViewsPickerattaches to the correct scroll container based on the mode.useIsHorizontalScrollEndreceives the appropriate ref so the actions column border logic works with either scroll mode.Testing Instructions
view.layout.scrollYset to'table'.scrollYunset or set to'wrapper'to confirm default behavior is unchanged.Testing Instructions for Keyboard
scrollY: 'table'option in a layout with route tabs and view actions in a shared toolbar. The table body scrolls while the toolbar andthead stay fixed.
scrollYcontrol to toggle betweenwrapperandtablemodes.