Repository navigation
fix(View): do not flatten a view whose accessibility props a container uses - #59817
Open
faciledictu wants to merge 1 commit into
Open
faciledictu wants to merge 1 commit into
faciledictu wants to merge 1 commit into
Conversation
…r uses Keep the view when iOS or Android reads one of its accessibility props from a container: label, role, state, actions, escape, magic tap, Large Content Viewer and ignoresInvertColors, as react#59335 did for accessibilityLiveRegion.
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.
Summary:
Fixes #59816.
ViewShadowNode::initializekeeps a host view for only a few accessibility props (accessible,accessibilityViewIsModal,accessibilityLiveRegionand three more). iOS and Android also read several others from a view that is not an accessibility element, and they are lost when the view is flattened:accessibilityLabel: TalkBack reads it from the container; an accessible ancestor builds its label from its subviews.accessibilityRole/roleandaccessibilityState: the TabBar trait on iOS; heading, checkable and the state on Android.accessibilityActions,onAccessibilityEscape,onAccessibilityMagicTap: iOS passes them to the elements inside or sends them up the hierarchy.accessibilityShowsLargeContentViewer,accessibilityIgnoresInvertColors: they apply to the subviews on iOS.This change keeps the view when any of them is set, as #59335 did for
accessibilityLiveRegion. The old architecture kept these views too.Left out on purpose:
accessibilityHint,accessibilityLanguageandaccessibilityValue, which are not read from a container, andaria-busy/aria-checked="mixed": on Android they go intocontentDescriptionand replace the children's text (a separate bug), so a kept view would be read as "busy".Changelog:
[GENERAL] [FIXED] - A
ViewwithaccessibilityLabel,role,accessibilityState,accessibilityActions,onAccessibilityEscapeor another accessibility prop read from a container is no longer flattenedTest Plan:
View-itest.js): thedoes not unflatten viewtests foraccessibilityLabel,accessibilityRoleandaccessibilityActionsasserted the bug and are nowunflattens view(theaccessibilityActionsone also checked the wrong prop). Added:roleandaria-checkedunflatten,aria-busyandaria-checked="mixed"do not. The iOS-only props are not in the view config Fantom uses. The rest of the suite passes, except 9LogBoxInspector*snapshot tests that fail the same way onmain(93019c4).collapsable={false}control (the results without the change are in Fabric flattens a View whose accessibility props iOS and Android read from a container: label, role, state, actions, escape #59816):