about summary refs log tree commit diff
path: root/src/view/shell/index.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-03-04 15:37:11 -0600
committerGitHub <noreply@github.com>2024-03-04 15:37:11 -0600
commit6c9d6f5b05953988cb4fb1556bf435805479e07e (patch)
tree98a19db445461f6c6007680aa0a8ede2e58634f1 /src/view/shell/index.tsx
parentebd279ed6839965af5e033ed7f430aa7401fd77d (diff)
downloadvoidsky-6c9d6f5b05953988cb4fb1556bf435805479e07e.tar.zst
Improve dialogs a11y (#3094)
* Improve a11y on ios

* Format

* Remove android

* Fix android
Diffstat (limited to 'src/view/shell/index.tsx')
-rw-r--r--src/view/shell/index.tsx16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx
index d895d8851..bdba79174 100644
--- a/src/view/shell/index.tsx
+++ b/src/view/shell/index.tsx
@@ -30,6 +30,7 @@ import {useCloseAnyActiveElement} from '#/state/util'
 import * as notifications from 'lib/notifications/notifications'
 import {Outlet as PortalOutlet} from '#/components/Portal'
 import {MutedWordsDialog} from '#/components/dialogs/MutedWords'
+import {useDialogStateContext} from '#/state/dialogs'
 
 function ShellInner() {
   const isDrawerOpen = useIsDrawerOpen()
@@ -55,6 +56,7 @@ function ShellInner() {
   const closeAnyActiveElement = useCloseAnyActiveElement()
   // start undefined
   const currentAccountDid = React.useRef<string | undefined>(undefined)
+  const {openDialogs} = useDialogStateContext()
 
   React.useEffect(() => {
     let listener = {remove() {}}
@@ -78,9 +80,21 @@ function ShellInner() {
     }
   }, [currentAccount])
 
+  /**
+   * The counterpart to `accessibilityViewIsModal` for Android. This property
+   * applies to the parent of all non-modal views, and prevents TalkBack from
+   * navigating within content beneath an open dialog.
+   *
+   * @see https://reactnative.dev/docs/accessibility#importantforaccessibility-android
+   */
+  const importantForAccessibility =
+    openDialogs.length > 0 ? 'no-hide-descendants' : undefined
+
   return (
     <>
-      <View style={containerPadding}>
+      <View
+        style={containerPadding}
+        importantForAccessibility={importantForAccessibility}>
         <ErrorBoundary>
           <Drawer
             renderDrawerContent={renderDrawerContent}