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

fix: role='label' not changing element to label. #2595

Closed
wants to merge 1 commit into from

Conversation

Viraj-10
Copy link

Problem Statement

with accessibilityRole="label
Code

<View accessibilityRole="label">

OutPut

<label />

with role="label

Code

<View role="label">

OutPut

<div />

Solution

  • Added condition for role="label".

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1097022:

Sandbox Source
react-native-web-examples Configuration

@albertcito
Copy link

Looks like it is already implemented. I read this comment

You can still output a element by setting the accessibilityRole to "label". That could be used to wrap fields in a . IIRC not every screen reader likes that pattern, which is why using accessibilityLabelledBy (web-only) along with JS to move the focus has benefits.

I added it to my code and it worked:

accessibilityRole="label"

@Viraj-10
Copy link
Author

Viraj-10 commented Feb 13, 2024

Looks like it is already implemented. I read this comment

You can still output a element by setting the accessibilityRole to "label". That could be used to wrap fields in a . IIRC not every screen reader likes that pattern, which is why using accessibilityLabelledBy (web-only) along with JS to move the focus has benefits.

I added it to my code and it worked:

accessibilityRole="label"

accessibilityRole prop was mapped to role in this PR in react-native. when you pass role="label" renders a <div> not a <label>.

@necolas
Copy link
Owner

necolas commented May 22, 2024

Duplicated by #2666

@necolas necolas closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants