Commit 1f80c34
Fix "detected text" annoucement
Summary:
There was a strange bug reported to us with `accessibilityOrder` where an OCR model would announce text on the screen sometimes. This would happen if a focused `View` without a label would wrap `Text` that was was not included in the `accessibilityOrder` array. What happens under the hood is we have a focused `View` trying to coopt a label. It finds no accessibility nodes under it (because the `Text` has `importantForAccessibility` set to `NO`) so it falls back to this weird TalkBack behavior. It both reads the text from the TextView and announces an OCR announcement - leading to repeating the text.
To fix this we just check if we are going to coopt text and if we do then we do not set `importantForAccessibility`. Behavior here changes a bit. Links are not accessible without having to reference the Text, setting `accessible={true}` on non-referenced `Text` will lead to be focusable.
These are both less bad than what we had before though, so I think this tradeoff is fine.
Changelog: [Internal]
Reviewed By: jorge-cab
Differential Revision: D741015301 parent f493689 commit 1f80c34
File tree
1 file changed
+25
-8
lines changed- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager
1 file changed
+25
-8
lines changedLines changed: 25 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| |||
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
104 | 117 | | |
105 | 118 | | |
106 | | - | |
| 119 | + | |
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
111 | 124 | | |
| 125 | + | |
| 126 | + | |
112 | 127 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
117 | 132 | | |
118 | 133 | | |
119 | | - | |
| 134 | + | |
120 | 135 | | |
121 | 136 | | |
122 | 137 | | |
123 | 138 | | |
124 | 139 | | |
125 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
126 | 143 | | |
127 | 144 | | |
128 | 145 | | |
| |||
0 commit comments