Skip to content

Commit 5ddfb6b

Browse files
committed
fix: fix accessibility and modal
1 parent 6e27087 commit 5ddfb6b

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/components/Dialog/Dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const DialogBase = (props: IDialogProps) => {
4747
} = theme.getDialogStyles();
4848

4949
return (
50-
<Modal visible={isVisible} transparent onDismiss={onClose}>
50+
<Modal visible={isVisible} transparent onRequestClose={onClose}>
5151
<View
5252
style={{
5353
...modalContainerStyle,

src/components/Dialog/Modal.web.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class Modal extends React.PureComponent<ModalProps> {
4343
}
4444

4545
public handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
46-
const { onDismiss } = this.props;
46+
const { onRequestClose } = this.props;
4747

48-
if (event.keyCode === ESC_KEY && onDismiss) {
48+
if (event.keyCode === ESC_KEY && onRequestClose) {
4949
event.stopPropagation();
50-
onDismiss();
50+
onRequestClose();
5151
}
5252
};
5353

src/components/Typography/Heading.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 { Text, TextProps, TextStyle } from 'react-native';
2+
import { Platform, Text, TextProps, TextStyle } from 'react-native';
33

44
import { HeadingSize, ITheme } from '../../theme/ThemeInterface';
55
import withTheme from '../../theme/withTheme';
@@ -28,7 +28,7 @@ const HeadingBase = (props: IHeadingProps & TextProps) => {
2828
return (
2929
<Text
3030
// @ts-ignore
31-
accessibilityRole="heading"
31+
accessibilityRole={Platform.OS === 'web' ? 'heading' : 'header'}
3232
aria-level={accessibilityLevel} // Web
3333
style={[{ textAlign }, headingStyle]}
3434
{...textProps}

src/components/Typography/ListItem.tsx

Lines changed: 3 additions & 5 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 { withTheme } from '../../theme';
55
import { TextColor, TextSize } from '../../theme/ThemeInterface';
@@ -33,10 +33,8 @@ const ListItemBase = (props: ITextProps & IListItemProps) => {
3333
) : null;
3434

3535
return (
36-
<View
37-
// @ts-ignore
38-
accessibilityRole="listitem"
39-
>
36+
// @ts-ignore
37+
<View accessibilityRole={Platform.OS === 'web' ? 'listitem' : undefined}>
4038
<Spacing flexDirection="row" alignItems="center" marginY={1}>
4139
<Spacing>{mark}</Spacing>
4240
<Spacing width="100%" paddingLeft={paddingLeft}>

0 commit comments

Comments
 (0)