question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not all Standard Roles/Traits supported

See original GitHub issue

Requires API Proposal

This issue may require a new API, or changes 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

On Android, not all roles are currently supported, and on iOS not all traits are currently supported.

Not all Android roles map cleanly to an iOS trait, and vice versa, so we may want to consider marking some of these in the documentation as iOS-only or Android-only.

The list of missing roles/traits is below under iOS and Android Details.

Furthermore, while some components allow you to technically set a role with the accessibilityRole prop, these are not always applied. <Button>, <Picker>, <Slider>, <TextInput>, <Switch>, and <AndroidProgressBar> have this issue. While this may have been an intentional choice, it feels broken from an API perspective to allow what looks like a role override prop to exist, but have it do nothing. If we allow this prop, it should correctly override the default role of the component.

React Native version:

v0.63

#Android Details The following Android roles are not currently supported:

  • checked_text_view
  • drop_down_list
  • edit_text
  • grid
  • list
  • pager
  • seek_control (slider)
  • toggle_button - #31419
  • view_group
  • web_view
  • drawer_layout
  • sliding_drawer
  • icon_menu
  • toast
  • date_picker
  • date_picker_dialog
  • time_picker
  • time_picker_dialog
  • number_picker
  • scroll_view
  • horizontal_scroll_view

Out of this list many of these roles are rarely used, but many are also quite common (such as list, edit_text, toast, and seek_control).

List of all roles here: https://github.com/google/talkback/blob/master/utils/src/main/java/Role.java

iOS Details:: The following iOS traits are not currently supported, but they don’t really make sense to be added to the “accessibilityRole” prop, as they are more metadata about the element than specific element types. We may want to consider adding specific APIs for these, or adding some new API for accessibility metadata like this.

  • causesPageTurn
  • startsMediaSession
  • allowsDirectInteraction
  • playsSound
  • updatesFrequently

The list of all iOS traits can he found here: https://developer.apple.com/documentation/objectivec/nsobject/uiaccessibility/accessibility_traits

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
blavallacommented, Sep 21, 2021

Just wanted to confirm that accessibilityRole='text' is not being read in TalkBack. Currently using react-native 0.63.4

Talkback doesn’t have an equivalent of iOS’s “StaticText” trait, which is what this role maps to on that platform, so there is no expected behavior when using this role on Android.

Thanks for that knowledge @blavalla ! I’m looking through MDN and any documentations regarding ARIA but can’t seem to find a straight answer but do you know if there is any sort of text-like equivalent for Android in that case? It seems like ‘header’ is the only one that comes closest but wanted to know if you knew

There isn’t really any equivalent on Android (at least with Talkback). Talkback basically treats elements without a defined role as “text” in this regard, but there is no special functionality related to these elements. Regardless of the elements role (button, checkbox, etc.), the basic text functionality of changing the readback granularity between letters, words, and all-at-once is available.

Androids TextView class does have a lot of accessibility specific behavior around things like text selection, copy/paste, and cursor control, but all of this is handled in the TextView class in Android (outside of Talkback), and can’t be emulated by simply switching roles. Under the hood, react Native’s <Text> component extends Androids AppCompatTextView class, which in turn extends TextView, giving all of this accessibility-specific functionality. If you are looking for the proper way to represent text on Android, I’d say using RN’s <Text> is your best bet.

1reaction
blavallacommented, Sep 20, 2021

Just wanted to confirm that accessibilityRole='text' is not being read in TalkBack. Currently using react-native 0.63.4

Talkback doesn’t have an equivalent of iOS’s “StaticText” trait, which is what this role maps to on that platform, so there is no expected behavior when using this role on Android.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exam 3 Sociology Flashcards - Quizlet
How does socialization impact male/female differences? Through gender socialization, we learn what is associated with being male or female (roles, traits, etc.).
Read more >
Name, Role and State of interactive components - GitHub Pages
But custom-built elements will require all accessibility roles/traits and properties ... If a widget does not have a 'Accessible Name' by default then...
Read more >
Articles - Perl.com
Unless a filehandle is specified, all standard printed output in Perl will ... All CPAN mirrors are not created equally though: the distribution...
Read more >
Mixin - Wikipedia
In object-oriented programming languages, a mixin (or mix-in) is a class that contains ... or to work around lack of support for multiple...
Read more >
Roles, traits and properties - Accessibility for Products - BBC
Standard elements generally provide roles, traits and properties by default within the platform. Custom elements and objects will require all accessibility ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found