Description
Description
When a Modal is opened while TalkBack is enabled, the last text element inside of a modal is announced before the first which is currently focused.
As in the Reproducer example, when this modal gets opened
<Modal>
<View>
<Text role="heading">Title</Text>
<Text>Body description</Text>
<Text>Body description 2</Text>
<Text>Body description 3</Text>
<Button title="Close Modal" />
</View>
</Modal>
The announcer will say Close Modal, title heading
while the focus is on the Title
.
The expected behavior would be it to say only title heading
Initially I found the bug on the version 0.74.5. However it's slightly different. On 0.74.5, the behavior is a bit flaky, but most of the time the first text item is announced instead, but ignoring its role. And the focus goes to the second element. So instead of TalkBack announcing title heading
, it announces title, body description
. So something changed between these versions, but neither have the expected behavior.
Steps to reproduce
- Install dependencies with
yarn
- Run metro server with
yarn start
- Run android app
yarn android
- Enable TalkBack on the emulators settings or by running
adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService
on the terminal - Press the
Open Modal
button
React Native Version
0.78.0
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 15.2
CPU: (12) arm64 Apple M3 Pro
Memory: 88.69 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.8.0
path: /opt/homebrew/bin/node
Yarn: Not Found
npm:
version: 10.8.2
path: /opt/homebrew/bin/npm
Watchman:
version: 2024.09.09.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2412.12266719
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.78.0
wanted: 0.78.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
N/A
Reproducer
https://github.com/JoaoMosmann/ReactNativeModalTalkBackBugReproducer
Screenshots and Videos
React Native 0.78.0 (Last text element is announced first)
https://github.com/user-attachments/assets/34c8161f-8b81-4d11-adc2-c3df52732978
React Native 0.74.5 (First element is announced, by without its role, but focus goes to second element instead)
https://github.com/user-attachments/assets/0047d323-d113-4293-b256-c5c6617e2ba2