Repository navigation
Conversation
With onPress, the title Text stayed accessible inside the Pressable, so Android (TalkBack and hardware keyboard) stopped on it twice. The Pressable already reads the title, so the inner Text is now accessible only when there is no onPress. Fixes callstack#5252
|
Found potential problems with the pull request:
|
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
With
onPress,Appbar.Contentis two focus stops on Android: thePressable(with the focus ring) and the titleTextinside it, which isaccessibleon its own. TalkBack reads the title twice, and Shift+Tab with a hardware keyboard stops twice.The
Pressablealready exposes the title as its label, so the innerTextis nowaccessibleonly when there is noonPress. A static title is unchanged: it stays an accessible heading.Related issue
Fixes #5252
Screenshots / Videos
No visual change.
Test plan
Appbar.test.tsx:buttonnamed "Title", and itsTextis not accessible. This test fails without the change.heading.jest src/components/__tests__/Appbar(83 passed),yarn typecheckandeslintpass.<Appbar.Content title="Title" onPress={() => {}} />and move through it with TalkBack or Tab / Shift+Tab. It should be a single stop that reads "Title, button". I haven't run this on a device myself.