From 75e1f06b66d3fb5addaaff1be8c7fba0a6552a8b Mon Sep 17 00:00:00 2001 From: threadhoard-vps Date: Tue, 19 May 2026 04:54:28 -0700 Subject: [PATCH] fix: align AccessibilityRole TypeScript definitions (#56863) Summary: - Align `ViewAccessibility.d.ts`'s `AccessibilityRole` union with the roles already supported by the Flow type and generated API snapshot. - Add TypeScript type coverage for `grid` and `pager`, which are among the roles missing from this declaration. ## Changelog: [General] [Fixed] - Align TypeScript accessibility role definitions with supported React Native accessibility roles Pull Request resolved: https://github.com/facebook/react-native/pull/56863 Test Plan: - `npx prettier --check packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts packages/react-native/types/__typetests__/index.tsx` - `npm run test-typescript -- --pretty false` - `npm run test-generated-typescript -- --pretty false` Reviewed By: huntie Differential Revision: D105592939 Pulled By: Abbondanzo fbshipit-source-id: 9b88c22091dc4051cc1c1c45a7424f078bc4dc54 --- .../Libraries/Components/View/ViewAccessibility.d.ts | 12 +++++++++++- packages/react-native/types/__typetests__/index.tsx | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts b/packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts index 8c7ef1e9930..7b22fb120e8 100644 --- a/packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts +++ b/packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts @@ -188,6 +188,7 @@ export interface AccessibilityValue { export type AccessibilityRole = | 'none' | 'button' + | 'dropdownlist' | 'togglebutton' | 'link' | 'search' @@ -215,7 +216,16 @@ export type AccessibilityRole = | 'tablist' | 'timer' | 'list' - | 'toolbar'; + | 'toolbar' + | 'grid' + | 'pager' + | 'scrollview' + | 'horizontalscrollview' + | 'viewgroup' + | 'webview' + | 'drawerlayout' + | 'slidingdrawer' + | 'iconmenu'; export interface AccessibilityPropsAndroid { /** diff --git a/packages/react-native/types/__typetests__/index.tsx b/packages/react-native/types/__typetests__/index.tsx index eb130ebd8ed..e3c90772a81 100644 --- a/packages/react-native/types/__typetests__/index.tsx +++ b/packages/react-native/types/__typetests__/index.tsx @@ -543,6 +543,8 @@ export class TouchableOpacityTest extends React.Component { accessibilityLabelledBy="my-label-text" aria-labelledby="my-label-text" /> + +