-
Notifications
You must be signed in to change notification settings - Fork 6
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
Write tests for input elements supplying name by aria-labelledby #165
Comments
I haven't seen this pattern attempted before... @scottaohara @accdc @MelSumner do you agree? In any case, writing a test to make sure all engines do the same thing seems reasonable to me. |
We'll also make sure the specs (AccName and/or HTML-AAM) explicitly acknowledge this expectation... |
mentioned in the ARIA WG meeting to get some more thoughts on this. |
@cookiecrook I looked at the WebKit issue, which has a CodePen attached. It took me a while to understand what was going on here, but I think in the end, the browser IS doing the correct thing. If the button is saying that it's accessible name comes from an input element, and that input element has a state, having all of that information read out is expected behavior, I think. If the author only wanted the label of the input element to be the accessible name of the button, then an It seems troublesome to expect otherwise. |
we briefly talked about this in the call last week, and while not common, i have seen people try to do this before. use aria-labelledby on one element to try and reference the name of another element. what wasn't clear from this but was displayed in the codepen demo is that webkit isn't calculating the name in the way that was expected, and the i've taken @extra808's simplified example in the initial post here, reversed it since otherwise we'd need to start at the last item and work backwards, and annotated it:
To compare:
Prior to testing this, I would have expected different browsers might handle this differently, and that arguably the guidance here could have revolved around trying not to chain together naming mechanisms like this. But per the above results, it seems that Safari on macOS is the odd one out. So it seems there is mostly alignment (that we should make a wpt for to solidify) |
@scottaohara ok, with your context it makes sense. Thanks for clarifying. I agree that there should be alignment. |
Using the value of an input, instead of its node contents or name, in the aria-labelledby computation is supposed to be limited to those where the user can change the value. https://w3c.github.io/accname/#comp_embedded_control Users can't change the value of an individual checkbox or radio button. I'm not going to test all form input elements but I did want to see how text inputs and selects are handled in practice. aria-labelledby referencing inputs The accessibility inspectors in Chrome, Firefox, and Safari for macOS are generally in agreement that the value (or text node of the selected |
Regardless of how an input element is named (implicit or explicit
<label>
,aria-label
,aria-labelledby
, etc.), or its input type, if another element references it usingaria-labelledby
, that name should be supplied.Example, both elements, button and input, should be read as "Check A" by assistive technologies:
<button aria-labelledby="check-a"></button> <input id="check-a" type="checkbox"> <label for="check-a">Check A</label>
Related WebKit (on macOS) bug: 284774
The text was updated successfully, but these errors were encountered: