Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set focus for accessibility VoiceOver #30771

Closed
disha98 opened this issue Jan 20, 2021 · 6 comments
Closed

Unable to set focus for accessibility VoiceOver #30771

disha98 opened this issue Jan 20, 2021 · 6 comments
Labels
Accessibility Team - Evaluated Accessibility Component: TextInput Related to the TextInput component. Resolution: Duplicate Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@disha98
Copy link

disha98 commented Jan 20, 2021

Description

I'm trying to set the focus order of elements in my screen for voiceover to announce in my Swift+RN project, however there is no provision to do the same. I also wanted to discuss if there's any straightforward way to set the focus to an element when a page loads.

We have made multiple attempts to use useRef (Setting focus for accessibility in RN) and none of these seem to be working for us.

iOS uses accessibilityElements to do the same and allows us to set the order of elements. I'm trying to find something similar on React Native which would help me set the reference.

On the web, screen readers determine the flow of which things are read by looking at the DOM tree and going from top the bottom, and this is the way accessibility is managed in React DOM.

However, on the native side this doesn't seem to be the case.

iOS exposes some APIs to allow developers to control this order, but React Native doesn't seem to expose that to the Javascript side.

I am displaying a RN module using the bridge from Swift, as a ViewController.

React Native version:

react-native: 0.63.3 => 0.63.3
OS: macOS 10.15.7
Xcode: 12.2

Steps To Reproduce

Navigating to the next screen in my React Native project does not allow me to set the focus to the first element that I want and the focus is incorrect. In cases where a view is presented in top of another view, the focus falls to the background instead. There are also multiple other issues we face in terms of VoiceOver flexibility.

Expected Results

Be able to set the focus order explicitly, set focus on a particular element when we navigate to a new page.

Apart from these issues on iOS, we also face issues on our parallel Android + RN app, where we are missing Keyboard (Physical BT Keyboard) focus (something similar to what is already mentioned in this issue. The issue of setting focus on a new page persists too.

@safaiyeh safaiyeh added Accessibility Component: TextInput Related to the TextInput component. and removed Needs: Triage 🔍 labels Jan 24, 2021
@nickmcmillan
Copy link

Facing the same problem. The ordering of my layout makes sense visually, but not for folks using Voiceover.

RPReplay_Final1612138964

Looks like this has been an unresolved issue for a while, here's an issue with a bit more activity: react-native-community/discussions-and-proposals#118

@amarlette
Copy link

This issue should be resolved by #30888 once that issue is closed as part of the Improved React Native Accessibility Project

@frags51
Copy link

frags51 commented Jul 16, 2021

+1, would appreciate this addition.

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 23, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@unyo
Copy link

unyo commented Jan 22, 2024

@nickmcmillan try grouping your elements using a <ScrollView> instead of a <View> react-native-community/discussions-and-proposals#389 (comment).

@disha98 focus can be set using AccessibilityInfo.setAccessibilityFocus, but I think the problem with the 'screens' (react-navigation?) kind of has to do with the fact that react-navigation uses virtual 'Views' instead of iOS's native 'Views', which I think trigger the Voiceover 'boop' saying a new View was loaded. This is similar to the issue we see in browser-based client-routed apps on the web, where Voiceover focus in IOS Safari (Chome is super broken) will focus in the middle of the page after a client-side route (<Link>), but if you click on a normal link (<a>), it will focus to the top of the page (and in OSX, will read through the page).

If I had the time I'd maybe check out react-navigation's native stack?

(See below: In swift, when using native View's the focus changes to the first item in the page - I added some native code to change the focus to the lower button, but as you can see it still focuses the first item on the page first - which (I think) means the only good option to control what iOS focuses on (even native) View load is the accessibility prop). Android is not as much of a pain as iOS, iirc it seems to follow DOM order and setAccessibilityFocus works as expected.

RPReplay_Final1705956302.2.MP4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Team - Evaluated Accessibility Component: TextInput Related to the TextInput component. Resolution: Duplicate Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

7 participants