This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
feat(FocusZone): add bidirectional navigation following DOM order #1647
Merged
Conversation
This file contains 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
sophieH29
requested review from
dvdzkwsk,
kuzhelov,
layershifter,
levithomason,
miroslavstastny and
mnajdova
as code owners
July 16, 2019 12:29
sophieH29
added
accessibility
All the Accessibility tasks and bugs should be tagged with this.
⚙️ enhancement
New feature or request
🚀 ready for review
labels
Jul 16, 2019
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
@@ Coverage Diff @@
## master #1647 +/- ##
==========================================
+ Coverage 71.29% 71.31% +0.02%
==========================================
Files 854 855 +1
Lines 7047 7052 +5
Branches 2029 2008 -21
==========================================
+ Hits 5024 5029 +5
Misses 2017 2017
Partials 6 6
Continue to review full report at Codecov.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
accessibility
All the Accessibility tasks and bugs should be tagged with this.
⚙️ enhancement
New feature or request
🚀 ready for review
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 -bidirectionalDomOrder
bidirectional
withbidirectionalDomOrder
inmenuAsToolbarBehavior
andtablistBheavior
, asbidirectional
is more calculation heavy by calculating position of the elments on a pagegridHorizontalBehavior
with using FocusZone withbidirectionalDomOrder
, to allow navigation described above.