Skip to content

Commit 434bf0f

Browse files
committed
fix: accessibility roles on RN
1 parent 020edc9 commit 434bf0f

5 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/components/Progress/Progress.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { View, ViewStyle } from 'react-native';
2+
import { Platform, View, ViewStyle } from 'react-native';
33
import { Spring } from 'react-spring';
44

55
import { ITheme, withTheme } from '../../theme';
@@ -40,7 +40,7 @@ const ProgressBase = (props: IProgressProps) => {
4040
>
4141
<View
4242
// @ts-ignore
43-
accessibilityRole="progress"
43+
accessibilityRole={Platform.OS === 'web' ? 'progress' : 'none'}
4444
style={{
4545
width: `${value}%`,
4646
...progressStyle,

src/components/Typography/Heading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const HeadingBase = (props: IHeadingProps & TextProps) => {
2828
return (
2929
<Text
3030
// @ts-ignore
31-
accessibilityRole={Platform.OS === 'web' ? 'heading' : 'header'}
31+
accessibilityRole={Platform.OS === 'web' ? 'heading' : 'none'}
3232
aria-level={accessibilityLevel} // Web
3333
style={[{ textAlign }, headingStyle]}
3434
{...textProps}

src/components/Typography/Label.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import { Platform } from 'react-native';
23

34
import withTheme from '../../theme/withTheme';
45
import Text, { ITextProps } from './Text';
@@ -9,7 +10,7 @@ const LabelBase = (props: ITextProps) => {
910
return (
1011
<Text
1112
// @ts-ignore
12-
accessibilityRole="label" // Web
13+
accessibilityRole={Platform.OS === 'web' ? 'label' : 'none'}
1314
{...textProps}
1415
>
1516
{children}

src/components/Typography/List.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { View } from 'react-native';
2+
import { Platform, View } from 'react-native';
33

44
import { TextSize } from '../../theme/ThemeInterface';
55
import { Spacing } from '../Layout';
@@ -34,7 +34,7 @@ export const List = (props: IListProps) => {
3434
return (
3535
<View
3636
// @ts-ignore
37-
accessibilityRole="list"
37+
accessibilityRole={Platform.OS === 'web' ? 'list' : 'none'}
3838
>
3939
<Spacing margin={0} marginLeft={1} padding={0}>
4040
{finalChildren}

src/components/Typography/ListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ListItemBase = (props: ITextProps & IListItemProps) => {
3434

3535
return (
3636
// @ts-ignore
37-
<View accessibilityRole={Platform.OS === 'web' ? 'listitem' : undefined}>
37+
<View accessibilityRole={Platform.OS === 'web' ? 'listitem' : 'none'}>
3838
<Spacing flexDirection="row" alignItems="center" marginY={1}>
3939
<Spacing>{mark}</Spacing>
4040
<Spacing width="100%" paddingLeft={paddingLeft}>

0 commit comments

Comments
 (0)