Skip to content

Commit a3633dc

Browse files
marcochavezfOSBotify
authored andcommitted
Merge pull request #81755 from Expensify/claude-fixA11yCheckedState
Fix: forward aria-checked for screen readers on checkbox and radio (cherry picked from commit d3321f1) (cherry-picked to staging by Julesssss)
1 parent 8e8108c commit a3633dc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/components/Checkbox.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ function Checkbox({
131131
style={[StyleUtils.getCheckboxPressableStyle(containerBorderRadius + 2), style]} // to align outline on focus, border-radius of pressable should be 2px more than Checkbox
132132
onKeyDown={handleSpaceOrEnterKey}
133133
role={CONST.ROLE.CHECKBOX}
134+
accessibilityState={{
135+
checked: isIndeterminate ? 'mixed' : isChecked,
136+
}}
134137
/* true → checked
135138
false → unchecked
136139
mixed → indeterminate */

src/components/Pressable/GenericPressable/implementation/BaseGenericPressable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ function GenericPressable({
200200
...accessibilityState,
201201
}}
202202
aria-disabled={isDisabled}
203+
aria-checked={accessibilityState?.checked}
203204
aria-selected={accessibilityState?.selected}
204205
aria-keyshortcuts={keyboardShortcut && `${keyboardShortcut.modifiers.join('')}+${keyboardShortcut.shortcutKey}`}
205206
// ios-only form of inputs

0 commit comments

Comments
 (0)