Skip to content

fix(accessibility): preserve inverted TalkBack order#2383

Open
maxwellyoung wants to merge 1 commit into
Shopify:mainfrom
maxwellyoung:fix/issue-2381-android-talkback-order
Open

fix(accessibility): preserve inverted TalkBack order#2383
maxwellyoung wants to merge 1 commit into
Shopify:mainfrom
maxwellyoung:fix/issue-2381-android-talkback-order

Conversation

@maxwellyoung

Copy link
Copy Markdown

Description

Android TalkBack traverses inverted FlashLists in the opposite direction from their visual order because the list and its cells are visually inverted with transforms while the native accessibility hierarchy keeps the original child order.

This adds an Android-only accessibility container that reverses only the children exposed through addChildrenForAccessibility when the list is inverted. Render order, layout, transforms, touch handling, and recycling remain unchanged. The JavaScript component falls back to a regular View when the native manager is unavailable, so an existing binary does not crash before its next native rebuild.

Fixes #2381

Reviewers' hat-rack 🎩

Please focus on the Android native view manager and whether accessibility-only child enumeration is the right boundary. The native container delegates unchanged for regular lists and performs one linear reversal only when Android requests accessible children from an inverted list.

Screenshots or videos

Verified with TalkBack on a Pixel 7 API 34 emulator using React Native 0.84:

  • Before: visible chat messages were exposed bottom-to-top in the accessibility hierarchy.
  • After: the same messages are exposed top-to-bottom, matching their screen coordinates and visual reading order.
  • The rendered chat screen remained visually unchanged.

Test plan

  • Full unit suite passes (yarn test --forceExit — 188 tests)
  • Type check passes (yarn type-check)
  • Lint passes (yarn lint)
  • Package build passes (yarn build)
  • Android library compiles (:shopify_flash-list:assembleDebug)
  • npm package dry-run contains the intended Android sources and no build artifacts
  • Reproduced before the fix and verified corrected TalkBack traversal on Android
  • Confirmed the non-Android component remains a regular React Native View

@maxwellyoung

Copy link
Copy Markdown
Author

I have signed the CLA!

@maxwellyoung

Copy link
Copy Markdown
Author

CLA is green now. @naqvitalha, when you have a moment, could you approve the first-time-contributor flash-list and website workflows and take a look? The branch is current with main; the Android library build, unit tests, type-check, lint, package build, and TalkBack emulator verification are all green locally. Happy to turn around any requested changes quickly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: TalkBack navigates inverted lists in reverse order

1 participant