This repository was archived by the owner on Mar 4, 2020. It is now read-only.
feat(FocusZone): add bidirectional navigation following DOM order#1647
Merged
feat(FocusZone): add bidirectional navigation following DOM order#1647
Conversation
jurokapsiar
approved these changes
Jul 16, 2019
bmdalex
approved these changes
Jul 17, 2019
hughreeling
reviewed
Jul 18, 2019
docs/src/examples/components/Grid/BestPractices/GridBestPractices.tsx
Outdated
Show resolved
Hide resolved
# Conflicts: # CHANGELOG.md # packages/react/src/components/Grid/Grid.tsx # packages/react/src/lib/accessibility/FocusZone/FocusZone.types.ts
Codecov Report
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr
Usually, when screen reader users navigate to menus or lists, they want to use Up/Down arrow keys as the semantic of these components stands for. In real-world, we have a lot of examples, where we have a horizontal list/menu or a grid with items. Keyboard users (not blind people) intentionally will want to use Left/Right arrow keys to navigate within these components.
To achieve consistency, Right/Down arrow keys should navigate to the next focusable item in the component. Left/Up arrow keys - to the previous focusable item. Note: in RTL mode, only left and arrow keys are switched.
Also, it is useful for Grid-like components (for e.g. emoji pickers). Screen readers are not aware of the grid so they would use Up/Down arrow keys to navigate through emoji as in the list. Keyboard users most probably will use Left/Right arrow keys to navigate in the grid, the focus will move horizontally row by row.
changes
FocusZone's enum -bidirectionalDomOrderbidirectionalwithbidirectionalDomOrderinmenuAsToolbarBehaviorandtablistBheavior, asbidirectionalis more calculation heavy by calculating position of the elments on a pagegridHorizontalBehaviorwith using FocusZone withbidirectionalDomOrder, to allow navigation described above.