-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Data Views][Grid Layout] Adding semantics and basic keyboard navigation #59279
base: trunk
Are you sure you want to change the base?
Conversation
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. |
Size Change: +815 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in f4363e9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8006619235
|
const [ resizeListener, { width: totalWidth } ] = useResizeObserver(); | ||
|
||
const referenceCell = | ||
gridRef?.current?.querySelector( '[role="gridcell"]' ) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of querying the DOM, would it make sense to add a ref
in Grid
component and then do something like: getComputedStyle(gridRef.current)?.getPropertyValue('grid-template-columns')
? Then we could derive the column count.
Thanks for splitting this work in smaller PRs! One of my main concerns is focusing non interactive elements, which seemed weird to me(for example the |
We may want to rebase this from |
@andrewhayward what're your thoughts on this alternative example for keyboard navigation? The arrow keys are still used to navigate them, but there's a single tab stop for grid items — tabbing doesn't go through all of them. In our case, we also have controls after the grid list (pagination), so I find this model would be a good fit for DataViews's Grid layout: it allows users to reach pagination quickly and it's similar to how list layout will work as well. Gravacao.do.ecra.2024-03-11.as.16.06.15.mov |
See also: #59188
What?
Adds structural semantics to grid layout, and improves keyboard navigation.
Why?
Grid layouts are currently semantically ambiguous, with no structural scaffolding to denote which fields relate to each other.
How?
role="grid"
role="gridcell"
role="row"
elementsTesting Instructions
Testing Instructions for Keyboard