-
Notifications
You must be signed in to change notification settings - Fork 27
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
Consider: hidden <label> can still name associated form control #370
Comments
@scottaohara is this aspirational? |
was discussed in the ARIA WG as something that isn't unreasonable to assume, and that there was desire for it re: accName spec as well. |
yeah I agree it would be good, needs implementations no? |
Should this apply to any "Host Language Label element" (using language from the AccName spec)?
would it be expected that the table has an accessible name of "Caption", or would it be empty? There is a similar question that could be asked for |
I think it's an unintentional bug in Chrome that a hidden does not name the control it points to. I see it as being the same thing as a hidden node being pointed to by aria-labelledby. There's no reason to treat it differently. |
i do wonder about @sivakusayan's example though. i agree there are probably use cases for setting an element to display: none / visibility: hidden, but still want that element to contribute to the accname without having to use ARIA. But if someone were to go ahead and put i guess the coutner argument there is that so. meh? |
Good question @sivakusayan. I suppose if we do nothing then we don't have to figure out the answer! |
ok, fun fact:
chrome presently returns no name for this legend. though visually "i want this as the name" renders correctly as the legend of the fieldset. |
bringing over jist of slack convo to here: but maybe if this was just limited to labels and form controsl with an explicit association, this would make sense. but if this then has the trickle down effect of making it nebulous if other hidden elements should still participate in the name computation, it gets messy/unpredictable. maybe it's enough that if you want to get a name from content that is specifically hidden form the a11y tree, that To get something out of this, maybe it could be explicitly stated (here and accName) that naming content from hidden nodes can only be done with The counter to this is someone figures out the various different corner cases (see fieldset example in my previous comment) where the hidden element should not provide the name. |
Alright, let's add text to help authors know they should use aria-labelledby when the native markup name source is hidden. Or something along those lines. I'm glad to not destabilize current implementations which are surprisingly consistent. |
I recently worked on some WPT tests for the “hidden not referenced” portion of the accname spec, and the results are up on wpt.fyi. I haven’t fully digested this thread yet, but it already smells like an additional |
from today's ARIA WG call, since this keeps coming up, probably best to add a note to HTML AAM that overtly states that if a label element is removed from the accessibility tree (e.g., hiding it) then it will not longer be able to provide a name to the input element that remains actually exposed by the browser if someone really wants to hide a label and associate it with the input, then aria-labelledby is the way to do that, since it can reference a hidden element for force the browser to look into that element and retrieve its text. |
Related WPT PR: web-platform-tests/wpt#44183 |
Yes please, explicitly clarifying that a hidden form field label element cannot be a valid label would be helpful. |
closes #370 Adds comments to label, legend and caption elements to indicate that if they are hidden, then they will not return a name for their associated elements. Note that right now this means that ``` <label for=d hidden>foo</label> <input id=d title=bar> ``` has _no name_. The label is still referenced, but because it is hidden it returns an empty name in Safari and Chromium browsers. Firefox correctly returns "bar" as the name of the input.
I’ve also added some new WPT tests in web-platform-tests/wpt#44965 in support of #533. |
See also: w3c/accname#148
The intent here is to clarify in HTML AAM that a hidden
<label>
element which is associated with a form control should still take part in the accName calculatione.g.,
the input should still have a name of "foo"
The text was updated successfully, but these errors were encountered: