-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v4][v5]: BottomSheetModal content not accessible by screen reader on iOS #1994
Labels
bug
Something isn't working
Comments
I agree, it's the same for me. The modal window behaves terribly or doesn't show up at all. |
obasille
changed the title
[Bug]:
[v4][v5]: BottomSheetModal content not accessible by screen reader on iOS
Oct 23, 2024
I've been needing to do this patch since forever: diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
index cd6ea6b..fa5dab2 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
@@ -167,9 +167,9 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
// accessibility
accessible: _providedAccessible = DEFAULT_ACCESSIBLE,
accessibilityLabel:
- _providedAccessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL,
+ _providedAccessibilityLabel = _providedAccessible ? DEFAULT_ACCESSIBILITY_LABEL : null,
accessibilityRole:
- _providedAccessibilityRole = DEFAULT_ACCESSIBILITY_ROLE,
+ _providedAccessibilityRole = _providedAccessible ? DEFAULT_ACCESSIBILITY_ROLE : null,
} = props;
//#endregion
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/constants.ts b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/constants.ts
index 07a8367..08ce167 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/constants.ts
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/constants.ts
@@ -34,7 +34,7 @@ const INITIAL_HANDLE_HEIGHT = -999;
const INITIAL_POSITION = SCREEN_HEIGHT;
// accessibility
-const DEFAULT_ACCESSIBLE = true;
+const DEFAULT_ACCESSIBLE = false;
const DEFAULT_ACCESSIBILITY_LABEL = 'Bottom Sheet';
const DEFAULT_ACCESSIBILITY_ROLE = 'adjustable';
const DEFAULT_ENABLE_ACCESSIBILITY_CHANGE_ANNOUNCEMENT = true;
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackground/BottomSheetBackground.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackground/BottomSheetBackground.tsx
index 71ce0c3..5924854 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackground/BottomSheetBackground.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackground/BottomSheetBackground.tsx
@@ -7,13 +7,7 @@ const BottomSheetBackgroundComponent = ({
pointerEvents,
style,
}: BottomSheetBackgroundProps) => (
- <View
- pointerEvents={pointerEvents}
- accessible={true}
- accessibilityRole="adjustable"
- accessibilityLabel="Bottom Sheet"
- style={[styles.container, style]}
- />
+ <View pointerEvents={pointerEvents} style={[styles.container, style]} />
);
const BottomSheetBackground = memo(BottomSheetBackgroundComponent);
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.tsx
index 80a859e..4e741fe 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetBackgroundContainer/BottomSheetBackgroundContainer.tsx
@@ -20,7 +20,7 @@ const BottomSheetBackgroundContainerComponent = ({
return _providedBackgroundComponent === null ? null : (
<BackgroundComponent
- pointerEvents="none"
+ pointerEvents="box-none"
animatedIndex={animatedIndex}
animatedPosition={animatedPosition}
style={backgroundStyle}
diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
index 275ce50..faee41e 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
@@ -34,6 +34,8 @@ const BottomSheetModalComponent = forwardRef<
BottomSheetModalProps
>(function BottomSheetModal(props, ref) {
const {
+ // Override default accessibility prop to ensure their content can be read by Voice Over (iOS screen reader)
+ accessible = false,
// modal props
name,
stackBehavior = DEFAULT_STACK_BEHAVIOR,
@@ -384,6 +386,7 @@ const BottomSheetModalComponent = forwardRef<
index={index}
snapPoints={snapPoints}
enablePanDownToClose={enablePanDownToClose}
+ accessible={accessible}
animateOnMount={animateOnMount}
containerHeight={containerHeight}
containerOffset={containerOffset}
@gorhom there are many similar reports for the past few months, please revert this PR until a better solution is found. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS
What happened?
Thanks for making this great library!
Contents of the BottomSheetModal component are not accessible by screen reader on iOS.
For some reason, passing the property "accessible={false}" seems to fix the issue.
See same issue on V4 here.
Reproduction steps
Run the given Snack on iOS.
Reproduction sample
https://snack.expo.dev/@zilhk/bottom-sheet-accessibility
Relevant log output
No response
The text was updated successfully, but these errors were encountered: