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

Android: Entrance/exit from collection #30861

Closed
4 tasks
amarlette opened this issue Feb 3, 2021 · 3 comments · Fixed by facebook/react-native-website#3224
Closed
4 tasks

Android: Entrance/exit from collection #30861

amarlette opened this issue Feb 3, 2021 · 3 comments · Fixed by facebook/react-native-website#3224
Labels

Comments

@amarlette
Copy link

amarlette commented Feb 3, 2021

Requires API Proposal

This issue may require a new API or a change to an existing API. An API proposal should be added and discussed before proceeding with implementation. The API proposal can be added in the comments of this issue or linked as a separate issue.

Description

Entrance/exit from collection Not supported by:

No components can be set as any collection role. With support for "List" or "Grid" roles would these would likely work as expected.

React Native version:

v0.63

Snack

https://snack.expo.io/Dh_iVb7F5

Expected Behavior

When first focusing into a collection element, screen readers will announce "in " (e.g. list, grid, pager, etc.), and when first focusing out of a collection, it will announce "out of ". This behavior happens automatically if the element has the proper role applied.

Android Details

This behavior is hinged on adding the proper accessibility role for these elements. Right now the accessibilityRole prop does not support a role of "list", "grid", or "pager" (the 3 collection types on Android), and adding them would be one solution to this problem. These roles could instead be set directly by the Android implementations for the above list components if we don't want to support these roles elsewhere.

To do this, you will need to set the className property on the AccessibilityNodeInfo associated with the list's View in Java to the role that Talkback expects (shown here: https://github.com/google/talkback/blob/master/utils/src/main/java/Role.java).

@blavalla
Copy link
Contributor

@lunaleaps , @kacieb , @nadiia , One way to fix this issue would be to have an accessibilityRole created for the collection types (list, grid, pager). These roles have no counterpart on iOS however.

Some roles that currently exist also seem to be no-ops for iOS, such as menubar (which just maps to a trait of "none" here: https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/React/Views/RCTViewManager.m?lines=50), but this is not really documented that some of these properties are iOS only or Android only.

Is the reactnative.dev documentation also in this repo? If so, should we open a task to document which roles are supported on which platforms?

@kacieb
Copy link
Contributor

kacieb commented Mar 3, 2021

One way to fix this issue would be to have an accessibilityRole created for the collection types (list, grid, pager). These roles have no counterpart on iOS however.

This sounds reasonable to me. I've marked that this one should have an API proposal before anyone implements it, since I imagine there are several ways of solving it (add new roles that are Android-only, or build it into the existing components natively, are two ways I can think of, although I think new roles makes the most sense).

Is the reactnative.dev documentation also in this repo? If so, should we open a task to document which roles are supported on which platforms?

We should definitely document which roles are supported on which platforms. Pull requests to update the website can be submitted here: https://github.com/facebook/react-native-website

@fabOnReact
Copy link
Contributor

fabOnReact commented Jul 25, 2022

roryabraham pushed a commit to Expensify/react-native that referenced this issue Aug 17, 2022
…4267)

Summary:
Adding grid role to ViewAccessibility to fix flow errors.
fixes facebook#30861 fixes facebook#30972

## Changelog

[General] [Fixed] - Adding grid role to ViewAccessibility to fix flow errors.

Pull Request resolved: facebook#34267

Test Plan:
<details><summary>flow error for missing accessibilityRole type grid</summary>
<p>

<image src="https://user-images.githubusercontent.com/24992535/180728969-beccb7f7-d882-4a94-831d-1c08822fc030.png" width="800" />
</p>
</details>

<details><summary>adding grid role to ScrollView</summary>
<p>

https://user-images.githubusercontent.com/24992535/180721100-62de76af-ea23-44a6-816e-f6fa39835b77.mp4
</p>
</details>

<details><summary>adding grid role to FlatList</summary>
<p>

https://user-images.githubusercontent.com/24992535/180724852-861c2981-0b06-4c66-a983-0017785062fe.mp4
</p>
</details>

<details><summary>adding grid role to SectionList</summary>
<p>

https://user-images.githubusercontent.com/24992535/180788810-d1869381-1e6b-42aa-b9b2-a84aece41326.mp4
</p>
</details>

Reviewed By: NickGerleman

Differential Revision: D38121921

Pulled By: dmitryrykun

fbshipit-source-id: 3bc335b3a525e75ae2e032f6a35540b3e95cd6a8
roryabraham pushed a commit to Expensify/react-native that referenced this issue Aug 17, 2022
…4267)

Summary:
Adding grid role to ViewAccessibility to fix flow errors.
fixes facebook#30861 fixes facebook#30972

## Changelog

[General] [Fixed] - Adding grid role to ViewAccessibility to fix flow errors.

Pull Request resolved: facebook#34267

Test Plan:
<details><summary>flow error for missing accessibilityRole type grid</summary>
<p>

<image src="https://user-images.githubusercontent.com/24992535/180728969-beccb7f7-d882-4a94-831d-1c08822fc030.png" width="800" />
</p>
</details>

<details><summary>adding grid role to ScrollView</summary>
<p>

https://user-images.githubusercontent.com/24992535/180721100-62de76af-ea23-44a6-816e-f6fa39835b77.mp4
</p>
</details>

<details><summary>adding grid role to FlatList</summary>
<p>

https://user-images.githubusercontent.com/24992535/180724852-861c2981-0b06-4c66-a983-0017785062fe.mp4
</p>
</details>

<details><summary>adding grid role to SectionList</summary>
<p>

https://user-images.githubusercontent.com/24992535/180788810-d1869381-1e6b-42aa-b9b2-a84aece41326.mp4
</p>
</details>

Reviewed By: NickGerleman

Differential Revision: D38121921

Pulled By: dmitryrykun

fbshipit-source-id: 3bc335b3a525e75ae2e032f6a35540b3e95cd6a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants