File tree Expand file tree Collapse file tree
tests/unit/libs/Accessibility Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Regression test for https://github.com/Expensify/App/issues/86534
3+ *
4+ * react-native-web's AccessibilityInfo.isScreenReaderEnabled() is hardcoded to
5+ * always resolve `true` (no browser API exists to detect screen readers). This
6+ * caused useScreenReaderStatus() to return `true` on web, which in turn blocked
7+ * auto-focus in useAutoFocusInput and similar hooks.
8+ *
9+ * The fix: a web-specific isScreenReaderEnabled module that always returns false,
10+ * so auto-focus is never skipped on web due to a phantom screen-reader detection.
11+ */
12+ describe ( 'isScreenReaderEnabled (web)' , ( ) => {
13+ it ( 'returns false even when AccessibilityInfo.isScreenReaderEnabled resolves to true' , async ( ) => {
14+ // Directly import the web module (index.ts, not index.native.ts).
15+ // jest-expo defaults to ios platform which would resolve index.native.ts,
16+ // but the fix lives in the web-specific index.ts.
17+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18+ const { default : isScreenReaderEnabled } = require ( '../../../../src/libs/Accessibility/isScreenReaderEnabled/index' ) as { default : ( ) => Promise < boolean > } ;
19+
20+ const result = await isScreenReaderEnabled ( ) ;
21+
22+ expect ( result ) . toBe ( false ) ;
23+ } ) ;
24+ } ) ;
You can’t perform that action at this time.
0 commit comments