vmware-clarity / starters

A collection of starter applications built with Clarity. Each starter project contains minimal default configuration and code to run and develop an application for a specific technology.
https://clarity.design
MIT License
19 stars 7 forks source link

Existing Issue: Datagrid checkboxes should not capture tab focus #87

Open steve-haar opened 2 years ago

steve-haar commented 2 years ago

Tab should not jump to the next datagrid checkbox, instead it should jump out of the grid

From Amy Li

when you use a datagrid you only use arrow keys to navigate between cells and tab key to enter or leave the entire datagrid getting to the checkbox cell should just be arrow keys

if you play with any of these w3 examples you can see that behavior https://www.w3.org/WAI/ARIA/apg/example-index/grid/dataGrids

kevinbuhmann commented 2 years ago

We allow keyboard users to resize columns by tabbing to the column separator and using the arrow keys. If tab jumps out of the grid, that won't work anymore.

kevinbuhmann commented 2 years ago

Fun related issue:

  1. Tab to a checkbox.
  2. Press the down arrow a few times.
  3. Press tab.
  4. Observe that the focus moves up to the checkbox below the one originally tabbed to.
Jinnie commented 2 years ago

I have to disagree. The checkbox is a standard control, it's not datagrid custom control. We can't take it out of tab order easily. We do transfer focus to it when using arrow keys, but taking it out of the tab sequence does not seem right to me. Even if we hack it for the checkboxes that we generate (the ones for selection) we won't be able to force it on any user-provided cells that may also contain checkboxes.

Also, the provided examples link (https://www.w3.org/WAI/ARIA/apg/example-index/grid/dataGrids) does not contain data grids with checkboxes

About Kevin's comment, yes this is a minor bug we may consider fixing. The key-nav service does not reinitialize its index on manual focus of an in-content input.

kevinbuhmann commented 2 years ago

I think Amy is correct here. The tab key should not force keyboard users to tab through each row in the grid to get out of it.

The W3 guidelines support this bug report as well.

Only one of the focusable elements contained by the grid is included in the page tab sequence.

https://www.w3.org/WAI/ARIA/apg/patterns/grid/

Jinnie commented 2 years ago

In ideal world, I agree this is best. But should we only do it for our own generated controls, or for user content too? Our users tend to put quite complex thing into grid cells, especially in expandable rows - they sometimes have whole child data grids inside. If we start stealing focus from them, we'll find ourselves in a big pool of bugs.