Skip to content

fix(a11y): add List and ListItem accessibility roles & collection met… - #58322

Open
Ajeethundal wants to merge 2 commits into
react:mainfrom
Ajeethundal:fix/a11y-list-collection-support
Open

fix(a11y): add List and ListItem accessibility roles & collection met…#58322
Ajeethundal wants to merge 2 commits into
react:mainfrom
Ajeethundal:fix/a11y-list-collection-support

Conversation

@Ajeethundal

Copy link
Copy Markdown

Summary:

Resolves #30973, #30974, #30975, and #30977.

Screen reader users relying on Android TalkBack and iOS VoiceOver require explicit collection semantics when navigating virtualized list components (FlatList, SectionList, VirtualizedList). Without these, screen readers treat items as isolated, uncounted views instead of announcing:

  • "In list, N items" when focusing the list container.
  • "Item X of Y" when focusing an item.
  • "Showing items X to Y of Z" when scrolling through list items.

This PR introduces built-in Accessibility Collection Semantics and list / listitem roles for all virtualized lists in React Native.

Key Implementation Highlights:

  1. View Accessibility Interface (ViewAccessibility.js):

    • Added 'listitem' to AccessibilityRole.
    • Added AccessibilityCollection and AccessibilityCollectionItem Flow types.
    • Added accessibilityCollection, accessibilityCollectionItem, aria-setsize, aria-posinset, aria-rowcount, aria-colcount to AccessibilityProps.
  2. Item-Level Semantics (VirtualizedListCellRenderer.js):

    • Automatically attaches accessibilityRole="listitem", aria-setsize={totalCount}, aria-posinset={index + 1}, and accessibilityCollectionItem (calculating dynamic rowIndex and columnIndex).
  3. Container-Level Semantics (VirtualizedList.js):

    • Outer list container automatically receives accessibilityRole="list" (or "grid" when numColumns > 1), aria-rowcount, and accessibilityCollection.
  4. Multi-Column Grid & Edge-Case Protections:

    • Grid Support (numColumns > 1): Dynamically computes row indices and column indices for multi-column FlatList grid layouts.
    • Opt-Out Prop (accessibilityCollectionEnabled): Added accessibilityCollectionEnabled?: boolean (defaults to true) allowing developers to bypass automatic attributes when needed.
    • Custom Role Preservation: Respects user-provided accessibilityRole overrides.

Changelog:

[GENERAL] [ADDED] - Add Accessibility Collection semantics and list/listitem roles to VirtualizedList, FlatList, and SectionList


Test Plan:

Automated Tests

  • Ran unit test suite in VirtualizedList-test.js:
yarn test packages/virtualized-lists/Lists/__tests__/VirtualizedList-test.js
  • Added test case verifying container accessibilityRole="list", aria-rowcount, item accessibilityRole="listitem", aria-setsize, aria-posinset, and accessibilityCollectionItem.

Device & Simulator Verification

  • Android TalkBack: Verified screen reader announces total count on list focus and item position during navigation.
  • iOS VoiceOver: Verified VoiceOver reads list container bounds and item indices.

@meta-cla

meta-cla Bot commented Sep 3, 2026

Copy link
Copy Markdown

Hi @Ajeethundal!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@Ajeethundal
Ajeethundal force-pushed the fix/a11y-list-collection-support branch from 4cde7b8 to c991dc2 Compare September 3, 2026 21:29
@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 Sep 3, 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 Sep 3, 2026
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.

Position in Collection not supported by Flatlist

1 participant