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

Button accessibility name doesn't indicate label element can be used #357

Closed
mraccess77 opened this issue Nov 22, 2021 · 3 comments · Fixed by #423
Closed

Button accessibility name doesn't indicate label element can be used #357

mraccess77 opened this issue Nov 22, 2021 · 3 comments · Fixed by #423
Labels
accName & Desc Related to accessible name or description

Comments

@mraccess77
Copy link

The label element seems to be usable to label buttons but this doesn't seem to be list in the accessible name calculation.

@jnurthen
Copy link
Member

jnurthen commented Nov 22, 2021

Also applies for <output> and all the other <input> types too

@carmacleod
Copy link
Contributor

The inputs in section 4.1 (type="text", "password", "search", "tel", "url" and textarea element) do mention label, as follows:

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

But the inputs in section 4.2 (type="button", "submit", "reset") don't mention label. So we can reuse the above wording for those.

The HTML labelable elements are: button, input (if the type attribute is not in the Hidden state), meter, output, progress, select, textarea, and form-associated custom elements

So from that list, we need to add the point about label to:

Note that section 4.7 Other form elements also mentions label:

  1. Otherwise use label element. (maybe this should have the same wording as section 4.1, above?)

Should we just assume that meter, progress, select, and FACE are lumped under "Other form elements", or should we call them out specifically? Also, should we specifically mention that input type="hidden" is not labelable?

@scottaohara
Copy link
Member

started on this some time ago re #225. clearly never got to finishing it. spent a bunch of time trying to make sense of how some of the button labeling needed to work / make things consistent.

seems this would also touch on #210

@scottaohara scottaohara added the accName & Desc Related to accessible name or description label Jan 23, 2022
scottaohara added a commit that referenced this issue Apr 12, 2023
closes #471

in resolving #357, I failed to update the text that says "if steps 1 to 2..." - as the inclusion of label added a 3rd step.
Looking at this further though, it seemed this could be clarified a bit more as the previous steps made it seem like if `value=""` was used, that the localized text strings of submit or reset should be used.  but that's not how this shakes out in reality, where if a value attribute is used, even if it's value is the empty string, it will become the control's accessible name.  

so the revised text is an attempt to make that clear, and purposefully removes saying to use the localized text string of submit or reset, since those can vary per browser.  Rather, I refer to these now as HTML does by saying the "implementation defined string".

The title attribute step was update to reference the fact that someone _could_ do <input type=submit value>` which would mean the button had no accName, so if that's the case, then `title` should be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accName & Desc Related to accessible name or description
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants