Skip to content

Commit 312db00

Browse files
authored
Revert "fix: Screen Reader: Many Pages: There is no dialog role and title announced"
1 parent 4e4263f commit 312db00

8 files changed

Lines changed: 231 additions & 718 deletions

File tree

src/CONST/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5858,8 +5858,6 @@ const CONST = {
58585858
NAVIGATION: 'navigation',
58595859
/** Use for Tooltips */
58605860
TOOLTIP: 'tooltip',
5861-
/** Use for dialog/modal elements */
5862-
DIALOG: 'dialog',
58635861
/** Use for data table containers. */
58645862
TABLE: 'table',
58655863
/** Use for table rows. */

src/components/DialogLabelContext.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/components/Header.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import type {ReactNode} from 'react';
2-
import React, {useEffect, useMemo, useRef} from 'react';
2+
import React, {useMemo} from 'react';
33
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
44
import {Linking, View} from 'react-native';
5-
import useDialogTitleFocus from '@hooks/useDialogTitleFocus';
65
import useThemeStyles from '@hooks/useThemeStyles';
76
import CONST from '@src/CONST';
8-
import {useDialogLabelActions} from './DialogLabelContext';
97
import EnvironmentBadge from './EnvironmentBadge';
108
import Text from './Text';
119
import TextLink from './TextLink';
@@ -38,37 +36,6 @@ type HeaderProps = {
3836

3937
function Header({title = '', subtitle = '', textStyles = [], style, containerStyles = [], shouldShowEnvironmentBadge = false, subTitleLink = '', numberOfTitleLines = 2}: HeaderProps) {
4038
const styles = useThemeStyles();
41-
const {isInsideDialog, pushLabel, popLabel, updateLabel} = useDialogLabelActions();
42-
const labelIdRef = useRef<number | undefined>(undefined);
43-
const titleRef = useRef<React.ComponentRef<typeof Text>>(null);
44-
45-
// Register/update label in dialog context (non-string titles are skipped).
46-
useEffect(() => {
47-
if (!isInsideDialog || typeof title !== 'string' || !title) {
48-
return;
49-
}
50-
if (labelIdRef.current === undefined) {
51-
labelIdRef.current = pushLabel(title);
52-
} else {
53-
updateLabel(labelIdRef.current, title);
54-
}
55-
}, [isInsideDialog, title, pushLabel, updateLabel]);
56-
57-
// Focus title after RHP transition completes (web only, no-op on native)
58-
useDialogTitleFocus(titleRef, isInsideDialog);
59-
60-
// Cleanup label on unmount
61-
useEffect(
62-
() => () => {
63-
if (labelIdRef.current === undefined) {
64-
return;
65-
}
66-
popLabel(labelIdRef.current);
67-
labelIdRef.current = undefined;
68-
},
69-
[popLabel],
70-
);
71-
7239
const renderedSubtitle = useMemo(
7340
() => (
7441
<>
@@ -109,12 +76,10 @@ function Header({title = '', subtitle = '', textStyles = [], style, containerSty
10976
{typeof title === 'string'
11077
? !!title && (
11178
<Text
112-
ref={isInsideDialog ? titleRef : undefined}
11379
numberOfLines={numberOfTitleLines}
11480
style={[styles.headerText, styles.textLarge, styles.lineHeightXLarge, textStyles]}
11581
accessibilityRole={CONST.ROLE.HEADER}
11682
accessibilityLabel={title}
117-
tabIndex={isInsideDialog ? -1 : undefined}
11883
>
11984
{title}
12085
</Text>

src/hooks/useDialogTitleFocus/index.native.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/hooks/useDialogTitleFocus/index.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)