-
Notifications
You must be signed in to change notification settings - Fork 847
Description
Product
axe-core
Product Version
4.4.2
Latest Version
- I have tested the issue with the latest version of the product
Issue Description
The following code snippet (reduced test case) was flagged as a critical impact error under the button-name rule. However, the button does have an accessible name as it is provided by its parent <label> element.
<label>
<button role=switch aria-checked=false></button>
Enable something
</label>
Example codepen: https://codepen.io/scottohara/pen/vYjrboB
Additional use case for associating a <label> with a <button> provided in pen.
It seems that maybe the rule for checking if a button has an accessible name doesn't take into account that a button can be provided its name via a <label> element association.
===
As a related note to this rule, the "to solve this problem, you need to..." section that accompanies this error ends with
Element's default semantics were not overridden with
role="none"orrole="presentation"
That seems out of place or incomplete guidance with this rule, as those roles would not be respected on a <button> due to the presentation role conflict resolutions and these roles are ignored outright so long as the button remains focusable.
So that bullet seems like it should either be removed, or it needs to explicitly indicate that the <button> needs to also have the disabled attribute so those roles won't be ignored on the button.
Related to the documentation piece of this issue, I've filed an issue against ARIA in HTML to better expose when role=none | presentation would be allowed on <button> and <input> elements.