RSP-1496: RadioGroup roving tabIndex#320
Merged
devongovett merged 11 commits intomasterfrom Apr 1, 2020
Merged
Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
devongovett
requested changes
Mar 30, 2020
| let activeChildren = React.Children.toArray(props.children).filter(child => !child.props.isDisabled); | ||
| let defaultFocusableRadio = selectedRadio || activeChildren[0] && activeChildren[0].props.value; | ||
|
|
||
| let [focusableRadio, setFocusableRadio] = useState(defaultFocusableRadio); |
Member
There was a problem hiding this comment.
I think we should leave it as null by default (when there's no selected radio), until one of the radios receives focus. All of the the radios would have tabIndex={0} by default. This way, if you shift tabbed into the radio group from after, the last radio would be focused instead of the first.
| inputProps: { | ||
| type: 'radio', | ||
| name, | ||
| tabIndex: focusableRadio === value ? 0 : -1, |
Member
There was a problem hiding this comment.
focusableRadio === value || focusableRadio == null ? 0 : -1
|
Build successful! 🎉 |
devongovett
reviewed
Apr 1, 2020
| let {focusableProps} = useFocusable(props); | ||
| let {focusableProps} = useFocusable({ | ||
| ...props, | ||
| onFocus: () => setFocusableRadio(value) |
Member
There was a problem hiding this comment.
This would override props.onFocus. We'd need to chain them.
|
Build successful! 🎉 |
|
Build successful! 🎉 |
devongovett
approved these changes
Apr 1, 2020
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Team: