Skip to content

Fix crash when accessibilityRole="tabbar" is used on Android - #57915

Closed
aravi365 wants to merge 1 commit into
react:mainfrom
aravi365:fix-android-tabbar-role
Closed

Fix crash when accessibilityRole="tabbar" is used on Android#57915
aravi365 wants to merge 1 commit into
react:mainfrom
aravi365:fix-android-tabbar-role

Conversation

@aravi365

Copy link
Copy Markdown
Contributor

Summary

Fixes #57890.

tabbar is part of the public AccessibilityRole union in both Flow and TypeScript, with nothing marking it iOS-only, and on iOS it maps to UIAccessibilityTraitTabBar. On Android the AccessibilityRole enum has no TABBAR entry, so fromValue() throws IllegalArgumentException from BaseViewManager.setAccessibilityRole during createViewInstance and the app crashes on mount. It is the only value in the union Android fails to resolve.

This adds TABBAR to the enum and maps it to android.view.View in getValue, next to TAB and TABLIST, which likewise have no dedicated Android widget. getValue is an exhaustive when with no else, so the second hunk is required for the enum addition to compile.

setRole already has an else branch, so no roleDescription is set for the new value. That looks right to me, since Android has no tab bar concept to announce, but happy to add a string resource if you'd prefer one.

Changelog:

[ANDROID] [FIXED] - Fix crash when accessibilityRole="tabbar" is used on Android

Test Plan

Added a unit test to ReactAccessibilityDelegateTest asserting that fromValue("tabbar") resolves to TABBAR and maps to android.view.View rather than throwing.

Repro from the issue:

<View accessibilityRole="tabbar">
  <Text>hello</Text>
</View>

Before: crashes on mount on Android with Invalid accessibility role value: tabbar.
After: renders as a plain view, matching iOS, where roles without a UIKit trait fall back rather than raising.

I have not run the Android suite locally, relying on CI for that.

tabbar is part of the public AccessibilityRole union in both Flow and
TypeScript with nothing marking it iOS-only, but the Android enum had
no TABBAR entry, so fromValue() threw during createViewInstance and the
app crashed on mount.

Add TABBAR to the enum and map it to android.view.View, alongside TAB
and TABLIST which also have no dedicated Android widget.

Fixes react#57890
@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 Aug 12, 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 Aug 12, 2026
@meta-codesync

meta-codesync Bot commented Aug 12, 2026

Copy link
Copy Markdown

@Abbondanzo has imported this pull request. If you are a Meta employee, you can view this in D115730694.

@meta-codesync meta-codesync Bot closed this in a4733b1 Aug 13, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Aug 13, 2026
@meta-codesync

meta-codesync Bot commented Aug 13, 2026

Copy link
Copy Markdown

@Abbondanzo merged this pull request in a4733b1.

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. Merged This PR has been merged. 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.

accessibilityRole="tabbar" throws "Invalid accessibility role value: tabbar" on Android

1 participant