Skip to content

Commit

Permalink
Mobile: Accessibility: Improve note list accessibility (#11419)
Browse files Browse the repository at this point in the history
  • Loading branch information
personalizedrefrigerator authored Nov 20, 2024
1 parent 13d8fbb commit 5d7d248
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/app-mobile/components/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { useState, useEffect, useCallback, useMemo } from 'react';
import { TouchableHighlight, StyleSheet, TextStyle } from 'react-native';
const Icon = require('react-native-vector-icons/Ionicons').default;
import Icon from './Icon';

interface Props {
checked: boolean;
Expand Down Expand Up @@ -44,7 +44,7 @@ const Checkbox: React.FC<Props> = props => {
});
}, [props.onChange]);

const iconName = checked ? 'checkbox-outline' : 'square-outline';
const iconName = checked ? 'ionicon checkbox-outline' : 'ionicon square-outline';
const styles = useStyles(props.style, props.iconStyle);

const accessibilityState = useMemo(() => ({
Expand All @@ -58,8 +58,10 @@ const Checkbox: React.FC<Props> = props => {
accessibilityRole="checkbox"
accessibilityState={accessibilityState}
accessibilityLabel={props.accessibilityLabel ?? ''}
// Web requires aria-checked
aria-checked={checked}
>
<Icon name={iconName} style={styles.icon} />
<Icon name={iconName} style={styles.icon} accessibilityLabel={null} />
</TouchableHighlight>
);
};
Expand Down
8 changes: 7 additions & 1 deletion packages/app-mobile/components/NoteItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ class NoteItemComponent extends PureComponent<Props, State> {
const noteTitle = Note.displayTitle(note);

return (
<TouchableOpacity onPress={this.onPress} onLongPress={this.onLongPress} activeOpacity={0.5}>
<TouchableOpacity
onPress={this.onPress}
onLongPress={this.onLongPress}
activeOpacity={0.5}
accessibilityHint={_('Opens note')}
accessibilityRole='button'
>
<View style={selectionWrapperStyle}>
<View style={opacityStyle}>
<View style={listItemStyle}>
Expand Down

0 comments on commit 5d7d248

Please sign in to comment.