Skip to content

Commit

Permalink
Mobile: Accessibility: Improve side menu and heading screen reader ac…
Browse files Browse the repository at this point in the history
…cessibility (#11427)
  • Loading branch information
personalizedrefrigerator authored Nov 22, 2024
1 parent a7add99 commit 5dfbb18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/app-mobile/components/ScreenHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,12 @@ class ScreenHeaderComponent extends PureComponent<ScreenHeaderProps, ScreenHeade
const title = 'title' in this.props && this.props.title !== null ? this.props.title : '';
return (
<>
<Text ellipsizeMode={'tail'} numberOfLines={1} style={this.styles().titleText}>{title}</Text>
<Text
ellipsizeMode={'tail'}
numberOfLines={1}
style={this.styles().titleText}
accessibilityRole='header'
>{title}</Text>
{hideableAfterTitleComponents}
</>
);
Expand Down
7 changes: 4 additions & 3 deletions packages/app-mobile/components/side-menu-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ const SideMenuContentComponent = (props: Props) => {
} else if (folderIcon.type === FolderIconType.DataUrl) {
return <Image style={styles_.folderImageIcon} source={{ uri: folderIcon.dataUrl }}/>;
} else if (folderIcon.type === FolderIconType.FontAwesome) {
return <Icon style={styles_.folderBaseIcon} name={folderIcon.name} accessibilityLabel={''}/>;
return <Icon style={styles_.folderBaseIcon} name={folderIcon.name} accessibilityLabel={null}/>;
} else {
throw new Error(`Unsupported folder icon type: ${folderIcon.type}`);
}
Expand Down Expand Up @@ -485,6 +485,7 @@ const SideMenuContentComponent = (props: Props) => {
event.preventDefault();
void folder_longPress(folder);
}}
accessibilityHint={_('Opens notebook')}
role='button'
>
<View style={folderButtonStyle}>
Expand All @@ -500,7 +501,7 @@ const SideMenuContentComponent = (props: Props) => {
};

const renderSidebarButton = (key: string, title: string, iconName: string, onPressHandler: ()=> void = null, selected = false) => {
let icon = <IonIcon name={iconName} style={styles_.sidebarIcon} aria-hidden={true} />;
let icon = <Icon name={`ionicon ${iconName}`} style={styles_.sidebarIcon} accessibilityLabel={null} />;

if (key === 'synchronize_button') {
icon = <Animated.View style={{ transform: [{ rotate: syncIconRotation }] }}>{icon}</Animated.View>;
Expand All @@ -516,7 +517,7 @@ const SideMenuContentComponent = (props: Props) => {
if (!onPressHandler) return content;

return (
<TouchableOpacity key={key} onPress={onPressHandler} role='button'>
<TouchableOpacity key={key} onPress={onPressHandler} accessibilityRole='button'>
{content}
</TouchableOpacity>
);
Expand Down

0 comments on commit 5dfbb18

Please sign in to comment.