-
Notifications
You must be signed in to change notification settings - Fork 784
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
False Positive: Form element has multiple <label> elements #689
Comments
@jnurthen Going by the WebAIM survey, IE is still the second most used browser with screen readers. https://webaim.org/projects/screenreadersurvey7/#browsers I don't think we can drop support for IE just yet. Axe is highly configurable, so you can turn off rules / checks that don't fit your accessibility support baseline. |
I think we should at least check the |
@WilcoFiers If someone is overriding the accessible name using aria-labelledby as in this example, why is the fact that there are multiple labels relevant? Neither of the elements are used in the accessible name calculation. They are ONLY here to act as a larger target area for mouse clicks. |
aria-labelledby should override the double labels Also, last I tested, VO did not respect double labels |
Sorry for reviving this thread. In @jnurthen's example one of the labels has Is that not a a valid case? Or should I also use |
I did not completely understand the conclusion on this thread. I faced the same situation today that WorldSpace attest (axe) is throwing the error "Form element has multiple elements" while using same label multiple times as shown below:
Is it not recommended to use multiple label with aria-hidden? Came across this issue which was resolved: |
I am re-opening this because the We need to decide how to handle this case:
I have tested on VO and it works correctly but we need more evidence that this is intended and fully implemented behavior |
AT often only reads the first/last visible label when multiple labels are associated with an element. When multiple label elements are present, they will both be read by AT if |
@AutoSponge two questions: Have you done the testing for the other accessibility supported ATs? |
I reworded my statement to "often". Based on 2008 study:
2012 Study (similar findings) |
After talking with @AutoSponge and @WilcoFiers, and running extensive tests (https://codepen.io/straker/full/PvqONy), this is what we've come up with:
Taking that all into account, I propose we update the rule to:
|
So now using multiple labels with 'for' attributes will pass so long as only one is visible and all label IDs are referenced in the aria-labelledby of the input. |
@cyrilledjdj - in a nutshell - yes |
@dylanb @jeankaplansky https://dequeuniversity.com/rules/axe/3.2/form-field-multiple-labels?application=AxeChrome is the relevant documentation. |
@aellsey Please move this to the next sprint. |
@dylanb : I take it you want the rule-help to clearly state @straker's plan?: "fail if there are multiple visible labels (even if aria-labelledby is present due to iOS Safari) Please advise. |
@AutoSponge : Please see my question to @dylanb above - I suspect he is too busy to answer. Please confirm that you implemented:
I'm reluctant to include this info in the rule help as it's default browser functionality + screen reader default functionality and the rule help is not designed to document browser or screen reader default functionality. PLEASE ADVISE:
cc: @JKODU, @WilcoFiers |
We can probably boil down the help text to say that there should only be one visible label per form element, with an expanded detail on the site help that talks about |
@straker : Thank you! that helps! Now... The rule help isn't supposed to document browser or screen reader default functionality. BUT... We know that default browser and screen reader default functionality does interfere with the markup intent... But we do have to say something about this in the rule help... How much is too much in this instance? My concern is that the minute I write that a browser/screen reader combo does A by default, a new release will come along and the default will change and we won't necessarily know it until someone stumbles on it some day. Note to self: https://codepen.io/straker/pen/PvqONy for example code that passes and doesn't pass. |
@jeankaplansky @straker I would like the examples that DO work to be listed in the help so that if there is a legitimate reason to "need" multiple labels, the correct way to do this is documented. |
@dylanb: partially documented in INR as "fix" - 6/17/2019; plan to include full examples from https://codepen.io/straker/pen/PvqONy and https://github.com/dequelabs/axe-core/blob/develop/test/integration/rules/form-field-multiple-labels/form-field-multiple-labels.json in delivered axe-core 3.3 rule help |
@straker @dylanb : Rule help per notes above is here: https://dequeuniversity.com/rules/axe/3.3/form-field-multiple-labels. Please confirm this is the level of detail you were looking for. Thanks. |
@chandana7393 Let me know if you need help in verifying this ticket. This ticket is in "Ready for QA" column for more than 20 day which is not good. |
IMO this rule should be retired completely. Multiple labels for a form field are allowed by spec and work in most useragents. I believe it is only IE where they do not. This would be the simplest way to resolve.
However, even if it were to be kept the following should certainly not throw an error
https://codepen.io/anon/pen/MrLgKm
Here there are 2 labels for the checkbox (the first is actually a CSS image in the real thing - but here I have added X for simplicity). They are both labels in order to increase the hit area for the checkbox. The first is hidden from screen readers with aria-hidden as it is not meaningful.
Even the addition of aria-labelledby on the checkbox which should override the labels does not seem to remove the aXe error.
The text was updated successfully, but these errors were encountered: