Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(FocusZone): add bidirectional navigation following DOM order #1647

Merged
merged 6 commits into from
Jul 19, 2019

Conversation

sophieH29
Copy link
Contributor

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

  • Add one more direction to FocusZone's enum - bidirectionalDomOrder
  • Substitute bidirectional with bidirectionalDomOrder in menuAsToolbarBehavior and tablistBheavior, as bidirectional is more calculation heavy by calculating position of the elments on a page
  • add gridHorizontalBehavior with using FocusZone with bidirectionalDomOrder, to allow navigation described above.

@sophieH29 sophieH29 self-assigned this Jul 16, 2019
@sophieH29 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
@vercel vercel bot requested a deployment to staging July 16, 2019 12:31 Abandoned
@vercel vercel bot requested a deployment to staging July 16, 2019 12:35 Abandoned
# Conflicts:
#	CHANGELOG.md
#	packages/react/src/components/Grid/Grid.tsx
#	packages/react/src/lib/accessibility/FocusZone/FocusZone.types.ts
@vercel vercel bot temporarily deployed to staging July 19, 2019 07:42 Inactive
@codecov
Copy link

codecov bot commented Jul 19, 2019

Codecov Report

Merging #1647 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
packages/react/src/components/Grid/Grid.tsx 100% <ø> (ø) ⬆️
...lib/accessibility/Behaviors/Tab/tabListBehavior.ts 100% <ø> (ø) ⬆️
...c/lib/accessibility/Behaviors/Grid/gridBehavior.ts 100% <ø> (ø) ⬆️
...ibility/Behaviors/Toolbar/menuAsToolbarBehavior.ts 100% <ø> (ø) ⬆️
...ssibility/Behaviors/Grid/gridHorizontalBehavior.ts 100% <100%> (ø)
...ages/react/test/specs/behaviors/testDefinitions.ts 93.08% <100%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e8547a...1c7dff7. Read the comment docs.

@sophieH29 sophieH29 merged commit bb8e686 into master Jul 19, 2019
@sophieH29 sophieH29 deleted the feat/focus-zone-horizontal-grid-navigation branch July 19, 2019 08:17
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants