Repository navigation
fix(switch): hide a read-only switch in a switch row with aria-hidden - #5254
Open
lukewalczak wants to merge 1 commit into
Open
lukewalczak wants to merge 1 commit into
lukewalczak wants to merge 1 commit into
Conversation
|
Found potential problems with the pull request:
|
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
This branch has not been deployed
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.
Motivation
The migration guide's pattern for a switch row nests
<Switch readOnly />in anaria-hiddenview inside a row withrole="switch". A read-only Switch still renders its ownrole="switch"and atabIndex, because React Native Web'sPressablealways sets one. So on web axe reportsnested-interactive(serious), and on Android the row contains a second, disabledandroid.widget.Switch.Switchnow acceptsaria-hidden. AreadOnlyordisabledswitch givenaria-hiddenrenders a plain view with no role and notabIndex. The prop has no effect on an interactive switch. The guide sample and the example app putaria-hiddenon the Switch itself:Related issue
Fixes #5245
Screenshots / Videos
None: rendering doesn't change. Accessibility tree, example app, TextInput › Controls:
mainnested-interactive(TextInput)nested-interactive(FAB, "Show FAB")android.widget.SwitchnodesSwitchelementsTest plan
npx expo start --webinexample/):nested-interactiveviolations.role="switch",tabIndex=-1andaria-readonly.