Closed mlewand closed 2 years ago
There's a curious thing in how we handle grids as some of them have not predefined columns.
For example, list styles have responsive grid, based only on CSS. However font colors do have predefined columns count.
As far as the implementation goes we might consider doing it as a helper rather than making this feature a UI component class.
An example of such composition-based approach is click outside handler: https://github.com/ckeditor/ckeditor5/blob/30286f77b39526fce2856b03b9be0ba4cc91d1c7/packages/ckeditor5-ui/src/bindings/clickoutsidehandler.js#L27
For the record, it looks like the table insertion grid should handle keyboard differently because when reaching the right boundary of the grid, the right arrow key should not move focus back to the first column (which would be expected in the color grid).
Yet another approach could be using a FocusCycler as it's already partly used in grid-based features. We'd have to enhance it for grids so e.g. the next/previous methods would 'know' that at some point a row of elements ends and we have to go to the beginning/end of the row instead of to the next/previous element. And of course we'd have to add vertical navigation as well for handling arrow up/down events.
We'd have to discuss if there should be one FocusCycler for everything or two FocusCyclers at the same time - one for main navigation and the second one for grid only.
There should be two different navigation handled (they shouldnโt be mixed together):
In case we decided using 2 focusCyclers, they will have to operate on two different levels - we cannot mix the levels in one focusCycler, e.g. cycling through sections of the view with tab key should be in a different focusCycler than moving between grid items with arrow keys.
Actually we came to the conclusion that there are 3 ways of handling this issue:
We agreed that the best option would be 2 (helper + GridView class).ย
A follow-up issue for keyboard navigation in color picker in table properties: #12193
Edit: Extracted to #12224 - let's keep this epic focused on keyboard only.
We focused exclusively on keyboard handling so far - but we need to remember that semantical markup is core requirement for this component.
I started a research on markup that we should produce for accessible grid components. The benefit of semantically marked grid is that it will convey information that this is a 2 dimension widget (has rows and columns).
<table>
element - so they went an extra mile ensuring that metadata is conveyed.Others simply donโt implement it well. They simple are using options.
<table>
with a grid
role and gridcell
role on focusable elements.
div[role=row]
with [aria-owns]
to mark relations which row contains which item.
div[role=row]
at runtime.[aria-owns]
attribute.aria-rowcount
on grid
element and aria-rowindex
on gridcell
.
role=row
wrappers is read properly.
Provide a description of the task
Research best practices on how to handle grid navigation using the keyboard.
We have multiple grid-like UI components:
To make it clear: this issue is just discovery. It's meant just to figure out best way to implement it and see why we have it implemented the way we did. We also can make some PoC to see how much effort will it require to fix it.
Once we have figured how this should be solved, we can move on to each separate issue.