fix(a11y): hide clear button on required select and array widgets#8315
Open
Wagner3UB wants to merge 5 commits into
Open
fix(a11y): hide clear button on required select and array widgets#8315Wagner3UB wants to merge 5 commits into
Wagner3UB wants to merge 5 commits into
Conversation
stevepiercy
requested changes
Jun 5, 2026
Collaborator
stevepiercy
left a comment
There was a problem hiding this comment.
A minor tweak and a question.
| @@ -0,0 +1 @@ | |||
| Hide the clear button in `SelectWidget` and `ArrayWidget` when the field is marked as required, and make it keyboard accessible (Tab, Enter, Space) on non-required fields. @Wagner3UB | |||
Collaborator
There was a problem hiding this comment.
A sprinkling of MyST fair dust.
Suggested change
| Hide the clear button in `SelectWidget` and `ArrayWidget` when the field is marked as required, and make it keyboard accessible (Tab, Enter, Space) on non-required fields. @Wagner3UB | |
| Hide the clear button in `SelectWidget` and `ArrayWidget` when the field is marked as required, and make it keyboard accessible ({kbd}`Tab`, {kbd}`Enter`, {kbd}`Space`) on non-required fields. @Wagner3UB |
| ...props.innerProps, | ||
| 'aria-hidden': false, | ||
| role: 'button', | ||
| tabIndex: 0, |
Collaborator
There was a problem hiding this comment.
Just to verify the desired behavior, if there are multiple controls each with a clear indicator of tabindex=0, then first the controls would be tab-able in the order they appear, followed by the clear buttons in the order they appear.
If it were me, instead I'd like to have the clear button tab-able immediately after its control.
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.
Partially fixes #5140
What
Improves keyboard accessibility for the clear button and hides it on required fields in
SelectWidgetandArrayWidget.Changes
SelectWidget/ArrayWidget:isClearablenow respects therequiredprop — the clear button is hidden on required fields.SelectStyling—ClearIndicator: overrides react-select's defaultaria-hidden="true"on the clear button, addingrole="button",tabIndex=0, and anonKeyDownhandler so the button is reachable via Tab and activatable with Enter or Space.Behavior after fix