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

Input with multiple explicit label elements associated #249

Closed
giacomo-petri opened this issue Dec 23, 2024 · 5 comments
Closed

Input with multiple explicit label elements associated #249

giacomo-petri opened this issue Dec 23, 2024 · 5 comments

Comments

@giacomo-petri
Copy link

Related to this: #108

What should happen if multiple label elements have the same for value?

Example:

<label for="test">This</label>
<label for="test">is</label>
<label for="test">a</label>
<label for="test">test</label>
<input type="text" id="test">

Browsers handle the calculation of the accessible name for the input inconsistently:

  • Chrome concatenates the strings "This is a test"
  • Safari uses only the first label, "This"
  • Firefox concatenates the strings "This is a test"

The accessible name algorithm relies on the host language "return that alternative in the form of a flat string as defined by the host language." However, the host language is not clear on this, and browser behavior is inconsistent.

Should we address this inconsistency? Should we request that the HTML specifications clarify this?

Once a decision is made, it might be useful to create a WPT issue to test the behavior (I can take care of this).

@scottaohara
Copy link
Member

scottaohara commented Dec 23, 2024

This is defined in html aam

I have a pr open now that cleans up the language a bit, but the current text is:

Otherwise use the associated label element or elements accessible name(s) - if more than one label is associated; concatenate by DOM order, delimited by spaces.

@giacomo-petri
Copy link
Author

Thank you @scottaohara! I've missed it. Opening WPT if not already existing.

@scottaohara
Copy link
Member

i "think" @adampage or @rahimabdi might have worked on wpts for this? i might be wrong. i can't check myself right now - but maybe look for PRs from them before starting up a new one?

@JAWS-test
Copy link

@scottaohara
Copy link
Member

Ha. I didn’t even remember I made that…

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

No branches or pull requests

3 participants