starters icon indicating copy to clipboard operation
starters copied to clipboard

Existing Issue: Datagrid checkboxes should not capture tab focus

Open steve-haar opened this issue 3 years ago • 5 comments

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

steve-haar avatar Aug 10 '22 20:08 steve-haar

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 avatar Aug 11 '22 17:08 kevinbuhmann

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.

kevinbuhmann avatar Aug 11 '22 17:08 kevinbuhmann

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.

Jinnie avatar Aug 15 '22 17:08 Jinnie

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/

kevinbuhmann avatar Aug 15 '22 17:08 kevinbuhmann

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.

Jinnie avatar Aug 16 '22 10:08 Jinnie