react / react/react-native

VoiceOver: Focus Returns to First Element Instead of Trigger Button After Closing Modal on iOS

Open
#45,098 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Button Component: Modal Issue: Author Provided Repro Platform: iOS Type: Unsupported Version
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

When VoiceOver is enabled on an iOS device, closing a modal by clicking the cancel button causes the focus to shift back to the first element of the screen instead of the button that triggered the modal. This issue negatively impacts the user experience for visually impaired users who rely on VoiceOver for navigation.

Steps to reproduce
  1. Ensure VoiceOver is enabled on the iOS device.
  2. Open the React Native application.
  3. Navigate to the screen that includes a header, body, and a button at the bottom of the screen.
  4. Click the button at the bottom of the screen to open the modal.
  5. Within the modal, click the cancel button to close the modal.
  6. Observe the focus behavior once the modal is closed.
React Native Version

0.74

Affected Platforms

Runtime - iOS

Output of npx react-native info
System:
    OS: macOS 13.6.5
    CPU: (8) arm64 Apple M1
    Memory: 121.14 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.7.1 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - ~/Desktop/project/sqh.projectorange.reactnative/node_modules/.bin/yarn
    npm: 10.5.0 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.10121639
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.15 => 0.71.8 
    react-native-macos: Not Found
Stacktrace or Logs
Since this issue is related to accessibility focus behavior, It will not generate any traditional error logs or stack traces.
Reproducer

https://github.com/akashsquare/accessibility_poc
https://snack.expo.dev/@akshay-sqh/accessibility-poc

Screenshots and Videos

https://github.com/facebook/react-native/assets/58284589/4002cdda-27f8-4a37-9bd6-686c27ac47ce

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked accessibility_poc reproducer in React Native 0.74 on iOS with VoiceOver enabled, then follow the listed modal and cancel-button steps. Confirm the observed focus destination after closing the modal and compare it with the expected behavior: focus should return to the button that opened it. No source file or test is named, so locating the relevant modal and accessibility-focus handling is part of the investigation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native
Domain
accessibility, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.