Skip to content

Commit 689ebb7

Browse files
authored
Fix/accss fixes (#634)
* Deleted unneeded button icon accessibilityRole * Switch accessibility fix * Switch accessibility fix * Added accessibilityRole to PickerDialog's done and cancel buttons
1 parent 6339929 commit 689ebb7

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/components/picker/PickerDialog.android.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class PickerDialog extends BaseComponent {
5656

5757
return (
5858
<View style={styles.footer}>
59-
<Text text80 blue30 onPress={onCancel} style={cancelLabelStyle}>
59+
<Text text80 blue30 onPress={onCancel} accessibilityRole={onCancel ? 'button' : undefined} style={cancelLabelStyle}>
6060
{cancelLabel}
6161
</Text>
62-
<Text text80 blue30 marginL-15 onPress={onDone} style={selectLabelStyle}>
62+
<Text text80 blue30 marginL-15 onPress={onDone} accessibilityRole={onDone ? 'button' : undefined} style={selectLabelStyle}>
6363
{doneLabel}
6464
</Text>
6565
</View>

src/components/picker/PickerDialog.ios.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class PickerDialog extends BaseComponent {
2727

2828
return (
2929
<View style={styles.header}>
30-
<Text text70 blue30 onPress={onCancel}>
30+
<Text text70 blue30 onPress={onCancel} accessibilityRole={onCancel ? 'button' : undefined}>
3131
{_.get(topBarProps, 'cancelLabel', 'Cancel')}
3232
</Text>
33-
<Text text70 blue30 onPress={onDone}>
33+
<Text text70 blue30 onPress={onDone} accessibilityRole={onDone ? 'button' : undefined}>
3434
{_.get(topBarProps, 'doneLabel', 'Done')}
3535
</Text>
3636
</View>

src/components/switch/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,12 @@ class Switch extends BaseComponent {
8181
}
8282

8383
getAccessibilityProps() {
84-
const {accessibilityLabel, disabled, value} = this.getThemeProps();
85-
const switchState = value ? 'on' : 'off';
84+
const {disabled, value} = this.getThemeProps();
8685

8786
return {
8887
accessible: true,
89-
accessibilityLabel: accessibilityLabel ? `${accessibilityLabel} ${switchState}` : `switch ${switchState}`, //TODO: RN60 fix label and role and convert to accessibilityActions
90-
accessibilityRole: 'button',
91-
accessibilityStates: disabled ? ['disabled'] : undefined
88+
accessibilityRole: 'switch',
89+
accessibilityStates: disabled ? ['disabled'] : value ? ['checked'] : ['unchecked']
9290
};
9391
}
9492

0 commit comments

Comments
 (0)