@@ -44,6 +44,10 @@ type Props = {
44
44
* Callback called when Menu is dismissed. The `visible` prop needs to be updated when this is called.
45
45
*/
46
46
onDismiss : ( ) => void ;
47
+ /**
48
+ * Accessibility label for the overlay. This is read by the screen reader when the user taps outside the menu.
49
+ */
50
+ overlayAccessibilityLabel ?: string ;
47
51
/**
48
52
* Content of the `Menu`.
49
53
*/
@@ -130,6 +134,7 @@ class Menu extends React.Component<Props, State> {
130
134
131
135
static defaultProps = {
132
136
statusBarHeight : APPROX_STATUSBAR_HEIGHT ,
137
+ overlayAccessibilityLabel : 'Close menu' ,
133
138
} ;
134
139
135
140
static getDerivedStateFromProps ( nextProps : Props , prevState : State ) {
@@ -339,6 +344,7 @@ class Menu extends React.Component<Props, State> {
339
344
theme,
340
345
statusBarHeight,
341
346
onDismiss,
347
+ overlayAccessibilityLabel,
342
348
} = this . props ;
343
349
344
350
const {
@@ -530,7 +536,11 @@ class Menu extends React.Component<Props, State> {
530
536
{ this . isAnchorCoord ( ) ? null : anchor }
531
537
{ rendered ? (
532
538
< Portal >
533
- < TouchableWithoutFeedback onPress = { onDismiss } >
539
+ < TouchableWithoutFeedback
540
+ accessibilityLabel = { overlayAccessibilityLabel }
541
+ accessibilityRole = "button"
542
+ onPress = { onDismiss }
543
+ >
534
544
< View style = { StyleSheet . absoluteFill } />
535
545
</ TouchableWithoutFeedback >
536
546
< View
@@ -541,6 +551,8 @@ class Menu extends React.Component<Props, State> {
541
551
accessibilityViewIsModal = { visible }
542
552
style = { [ styles . wrapper , positionStyle , style ] }
543
553
pointerEvents = { visible ? 'box-none' : 'none' }
554
+ // @ts -ignore - FIX ME
555
+ onAccessibilityEscape = { onDismiss }
544
556
>
545
557
< Animated . View style = { { transform : positionTransforms } } >
546
558
< Surface
0 commit comments