This repository was archived by the owner on Mar 4, 2020. It is now read-only.
fix(dropdown): applied roving tabindex technique to selected dropdown items#1004
Merged
silviuaavram merged 10 commits intomasterfrom Mar 5, 2019
Merged
fix(dropdown): applied roving tabindex technique to selected dropdown items#1004silviuaavram merged 10 commits intomasterfrom
silviuaavram merged 10 commits intomasterfrom
Conversation
mnajdova
reviewed
Mar 1, 2019
|
|
||
| componentDidUpdate(prevProps: DropdownSelectedItemProps) { | ||
| if (!prevProps.active && this.props.active) { | ||
| this.itemRef.current.setAttribute('tabindex', '0') |
Contributor
There was a problem hiding this comment.
We definitely should start extracting behavior for the Dropdown component, we have too much coupling of accessibility concerns in the component... That way we would test this things separately.
mnajdova
approved these changes
Mar 1, 2019
Contributor
mnajdova
left a comment
There was a problem hiding this comment.
Approved, just update the changelog, and let's start with extracting these things to behavior
Codecov Report
@@ Coverage Diff @@
## master #1004 +/- ##
=========================================
+ Coverage 81.37% 81.5% +0.12%
=========================================
Files 673 673
Lines 8699 8700 +1
Branches 1475 1476 +1
=========================================
+ Hits 7079 7091 +12
+ Misses 1605 1594 -11
Partials 15 15
Continue to review full report at Codecov.
|
layershifter
suggested changes
Mar 1, 2019
Member
layershifter
left a comment
There was a problem hiding this comment.
What it is the reason to use DOM API?
<Label tabIndex={active ? 0 : -1} />
layershifter
approved these changes
Mar 4, 2019
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.
Without it, when in a Popup and a selected item is focused, shift tab will make focus escape the Popup, as FocusTrapZone will not handle it as first focusable item in the Popup (due to the lack of tabindex="0").
Also it does not hurt to be able to come back to the selected item via tab/shift tab once you tabbed/shift tabbed away.