From 7a19af7fb6b3b62fbbd632c6569a4270c604fb86 Mon Sep 17 00:00:00 2001 From: ankit-tailor Date: Wed, 26 Oct 2022 11:47:58 -0700 Subject: [PATCH] fix: add mixed to aria-checked typings (#34633) Summary: `aria-checked` prop should accept `mixed` as value as given [here](https://www.w3.org/WAI/GL/wiki/Using_WAI-ARIA_aria-checked%3Dmixed) and also [accessibilityState.checked](https://reactnative.dev/docs/accessibility#accessibilitystate) accepts mixed to represent checkboxes. This change refers to issue https://github.com/facebook/react-native/issues/34424 and PR https://github.com/facebook/react-native/pull/34524 ## Changelog [General] [Added] - Added `mixed` value for `aria-checked`. Pull Request resolved: https://github.com/facebook/react-native/pull/34633 Test Plan: ```js Checkbox example ``` Reviewed By: lunaleaps Differential Revision: D39382158 Pulled By: necolas fbshipit-source-id: fa026274111305cc0bcbb42ed974ca1be7d779a5 --- Libraries/Components/Button.js | 2 +- Libraries/Components/Pressable/Pressable.js | 2 +- Libraries/Components/Touchable/TouchableWithoutFeedback.js | 2 +- Libraries/Components/View/ViewAccessibility.d.ts | 2 +- Libraries/Components/View/ViewPropTypes.js | 2 +- Libraries/Text/TextProps.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index f0758e18a2cd81..0395706d2608a8 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -157,7 +157,7 @@ type ButtonProps = $ReadOnly<{| * see https://reactnative.dev/docs/accessibility#accessibilitystate */ 'aria-busy'?: ?boolean, - 'aria-checked'?: ?boolean, + 'aria-checked'?: ?boolean | 'mixed', 'aria-disabled'?: ?boolean, 'aria-expanded'?: ?boolean, 'aria-selected'?: ?boolean, diff --git a/Libraries/Components/Pressable/Pressable.js b/Libraries/Components/Pressable/Pressable.js index 976509109f2ef6..187b4c4a5b00f4 100644 --- a/Libraries/Components/Pressable/Pressable.js +++ b/Libraries/Components/Pressable/Pressable.js @@ -65,7 +65,7 @@ type Props = $ReadOnly<{| * see https://reactnative.dev/docs/accessibility#accessibilitystate */ 'aria-busy'?: ?boolean, - 'aria-checked'?: ?boolean, + 'aria-checked'?: ?boolean | 'mixed', 'aria-disabled'?: ?boolean, 'aria-expanded'?: ?boolean, 'aria-selected'?: ?boolean, diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 0fd50298d201ea..70b43370b11f6c 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -54,7 +54,7 @@ type Props = $ReadOnly<{| * see https://reactnative.dev/docs/accessibility#accessibilitystate */ 'aria-busy'?: ?boolean, - 'aria-checked'?: ?boolean, + 'aria-checked'?: ?boolean | 'mixed', 'aria-disabled'?: ?boolean, 'aria-expanded'?: ?boolean, 'aria-selected'?: ?boolean, diff --git a/Libraries/Components/View/ViewAccessibility.d.ts b/Libraries/Components/View/ViewAccessibility.d.ts index 8f530a78c19848..5fad1607d973cb 100644 --- a/Libraries/Components/View/ViewAccessibility.d.ts +++ b/Libraries/Components/View/ViewAccessibility.d.ts @@ -53,7 +53,7 @@ export interface AccessibilityProps * see https://reactnative.dev/docs/accessibility#accessibilitystate */ 'aria-busy'?: boolean | undefined; - 'aria-checked'?: boolean | undefined; + 'aria-checked'?: boolean | 'mixed' | undefined; 'aria-disabled'?: boolean | undefined; 'aria-expanded'?: boolean | undefined; 'aria-selected'?: boolean | undefined; diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 3a88f4ce089dc4..2330f45c0051e0 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -531,7 +531,7 @@ export type ViewProps = $ReadOnly<{| * see https://reactnative.dev/docs/accessibility#accessibilitystate */ 'aria-busy'?: ?boolean, - 'aria-checked'?: ?boolean, + 'aria-checked'?: ?boolean | 'mixed', 'aria-disabled'?: ?boolean, 'aria-expanded'?: ?boolean, 'aria-selected'?: ?boolean, diff --git a/Libraries/Text/TextProps.js b/Libraries/Text/TextProps.js index 4ef9e7cec3ce39..abbbd76da14cad 100644 --- a/Libraries/Text/TextProps.js +++ b/Libraries/Text/TextProps.js @@ -86,7 +86,7 @@ export type TextProps = $ReadOnly<{| * see https://reactnative.dev/docs/accessibility#accessibilitystate */ 'aria-busy'?: ?boolean, - 'aria-checked'?: ?boolean, + 'aria-checked'?: ?boolean | 'mixed', 'aria-disabled'?: ?boolean, 'aria-expanded'?: ?boolean, 'aria-selected'?: ?boolean,