Skip to content

fix(View): do not flatten a view whose accessibility props a container uses - #59817

Open
faciledictu wants to merge 1 commit into
react:mainfrom
faciledictu:fix/flattening-a11y-props
Open

faciledictu wants to merge 1 commit into
react:mainfrom
faciledictu:fix/flattening-a11y-props

Conversation

@faciledictu

@faciledictu faciledictu commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Fixes #59816.

ViewShadowNode::initialize keeps a host view for only a few accessibility props (accessible, accessibilityViewIsModal, accessibilityLiveRegion and 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 / role and accessibilityState: 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, accessibilityLanguage and accessibilityValue, which are not read from a container, and aria-busy / aria-checked="mixed": on Android they go into contentDescription and replace the children's text (a separate bug), so a kept view would be read as "busy".

Changelog:

[GENERAL] [FIXED] - A View with accessibilityLabel, role, accessibilityState, accessibilityActions, onAccessibilityEscape or another accessibility prop read from a container is no longer flattened

Test Plan:

  • Fantom (View-itest.js): the does not unflatten view tests for accessibilityLabel, accessibilityRole and accessibilityActions asserted the bug and are now unflattens view (the accessibilityActions one also checked the wrong prop). Added: role and aria-checked unflatten, aria-busy and aria-checked="mixed" do not. The iOS-only props are not in the view config Fantom uses. The rest of the suite passes, except 9 LogBoxInspector* snapshot tests that fail the same way on main (93019c4).
  • On devices, with https://github.com/faciledictu/rn-a11y-flattening-repro and 0.88.0 built from source with this change backported, each flattened View now matches its 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):
    • Android, the accessibility nodes on a device: sections 1, 2, 3, 6, 7, 8 and 13.
    • iOS simulator, Accessibility Inspector: sections 2, 3, 4, 5, 6 and 10 (the label "Close dialog P1" instead of "× P1", the Archive action, the Large Content Viewer, Smart Invert).
    • iPhone, VoiceOver: the tab is read as "Tab K1, tab, 1 of 2", and escape runs its own wrapper's handler, not the other dialog's.

…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.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 6, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fabric flattens a View whose accessibility props iOS and Android read from a container: label, role, state, actions, escape

1 participant