Skip to content

Commit

Permalink
[IOPLT-381] Fix accessibility attributes on ListItemCheckbox (#202)
Browse files Browse the repository at this point in the history
## Short description
This PR fixes accessibility behaviour on `ListItemCheckbox`.

Extends props on NativeSwitch

## List of changes proposed in this pull request
- ListItemCheckbox - fixes accessibility handling
- NativeSwitch - extends native props support

## How to test
Accessibility should work properly on both components
  • Loading branch information
CrisTofani authored Feb 29, 2024
1 parent 8e03e96 commit efabd8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/listitems/ListItemCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const ListItemCheckbox = ({
description,
icon,
selected,
accessibilityLabel,
disabled,
onValueChange
}: OwnProps) => {
Expand Down Expand Up @@ -128,6 +129,13 @@ export const ListItemCheckbox = ({
onPressOut={handlePressOut}
onTouchEnd={handlePressOut}
testID="ListItemCheckbox"
accessible={true}
accessibilityLabel={accessibilityLabel}
accessibilityRole="checkbox"
accessibilityState={{
checked: selected ?? toggleValue,
disabled: !!disabled
}}
disabled={disabled}
>
<Animated.View
Expand Down
9 changes: 8 additions & 1 deletion src/components/switch/NativeSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import { IOSwitchVisualParams } from "../../core/IOStyles";

type OwnProps = Pick<
SwitchProps,
"onValueChange" | "value" | "accessible" | "accessibilityLabel"
| "onValueChange"
| "value"
| "accessible"
| "accessibilityLabel"
| "testID"
| "disabled"
| "accessibilityElementsHidden"
| "importantForAccessibility"
>;

// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
Expand Down

0 comments on commit efabd8d

Please sign in to comment.