Open jcfilben opened 2 years ago
Related to discussions in https://github.com/grommet/grommet/issues/5677
Adding notes from Chat GPT prompts on this topic...
Purpose - The tab key is used to move focus between interactive elements in a form or interface, following the document's natural flow. It's a key component of keyboard accessibility.
Appropriate for
Limitations
Example Components
Purpose - Arrow keys are typically used for fine-grained navigation within a confined component, like moving between options in a dropdown, tabs, or rows in a data grid. They provide more detailed control within a component's options.
Appropriate for
Limitations
Screen Reader Reservations - In screen readers, arrow keys are often reserved for content reading (moving line by line or through headings), so relying on arrows for main navigation could interfere with the screen reader’s function.
Example Components
When using arrow key based navigation in a component should the focus indicator remain on the container or be placed on the individual item within the component?
Answer:
The focus indicator should generally be placed on the individual item within the component rather than the container. Here’s why:
Clear Selection: Placing the focus indicator on the individual item helps users easily see which item is currently selected, especially when navigating through lists or grids.
Intuitive Navigation: Users expect the focus to move with the arrow keys. Highlighting the item directly conveys that the selection has changed.
Accessibility: This approach supports screen reader users and those relying on keyboard navigation, making it clear which specific element is active.
Consistency: Keeping the focus indicator on items aligns with common UI patterns, making it familiar and intuitive for users.
In summary, the focus should be on the individual items to enhance usability and accessibility.
Hi @jcfilben. @SOjaHPE showed this to me today. I filed an accessibility epic against the global header which is relevant to this. GLCP-176633
I detemined that Bill T has to navigate using arrow keys because they reads the UI text and tab stops in the global header don't provide enough context.
The global header, and the UI components I've worked with in the past, are designed for tab navigation between components and arrow navigation within components. The global header works great that way but is a nightmare when you navigate between components with arrow keys. The issue is that the tab stops have to provide good context for screen reader users.
Currently on Grommet we have a mix of components that use arrow keys to navigate and some components that use tab to navigate. There are also components that leave the focusIndicator on the container, components that have the focusIndicator on items within the container, and components that don't show a focusIndicator.
It would be great to gain more clarity on what the correct accessibility behavior is.
Tab based navigation components:
Arrow key based navigation components:
Supports both: