[Data Views][Grid Layout] Adding semantics and basic keyboard navigation#59279
[Data Views][Grid Layout] Adding semantics and basic keyboard navigation#59279andrewhayward wants to merge 4 commits intotrunkfrom
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.
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 |
|
It's been a couple of years since this PR, so I'm going to close it. Feel free to reopen based on the new code (a lot has changed since). |
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