Skip to content

Android: One element labelling another #30846

Closed
react/react-native-website
#3249

Description

@amarlette

Requires API Proposal

This issue requires a new 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

No concept of "labelFor" or "labeledBy" or any way to pass a reference to another element as the accessibilityLabel property of an element. Used most when building complex forms.

React Native version:

v0.63

Expected Behavior

Android has a labelFor property on View, which allows you to pass a reference to the ID of another view, that this view should act as the label for. When Focusing on the other view, it will announce for <other view's label>.

For example, if you have these two Views

<Text labelFor="123">Wifi</Text>
<Checkbox accessibilityLabel="checkbox" id="123" />

And you focus on the checkbox, it would announce "checkbox for Wifi".

Android Details

Any API to add this feature should manipulate the underlying View's labelFor property. It will need a reference of the ID of the element that is being labelled to properly work.

Activity

  1. kacieb commented on Mar 3, 2021

    @kacieb
    Contributor

    There is an existing testID property, I wonder if that could be used for this. I'm not sure though as I'm not sure the underlying implementation.

  2. blavalla commented on Apr 14, 2021

    @blavalla
    Contributor

    See the comment here on one potential approach for implementation:

    #26739 (comment)

  3. added
    Needs: Docs Website PR
    and removed on Apr 29, 2021
  4. grgr-dkrk commented on Oct 26, 2021

    @grgr-dkrk
    Contributor

    @blavalla @amarlette @kacieb
    I apologize for not making a proposal here.
    I'm working on this with #32470.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AccessibilityAccessibility Team - EvaluatedNeeds: Docs Website PRPlatform: AndroidReact Native Engineering - Evaluated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions