-
Notifications
You must be signed in to change notification settings - Fork 781
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 failure: button with role of combobox fails for missing discernible text #4472
Comments
Thanks for the issue. There's a lot going on with this so I'll try to list them as best as I can. The main issue is that the Using a label for a button is not currently supported in axe-core as we found it lacked support in some assistive technologies. This may change as we readjust what our accessibility supported assistive technologies are, in which case we'll need to update the rule to handle buttons that are named from labels. I tested out a button with role combobox in various screen readers and this is the result: <button id="combobox-el" role="combobox" aria-controls="cb-listbox" aria-required="true" aria-expanded="false">
<div>Combobox Display Text</div>
</button>
So it seems the text content is supported, but with VoiceOver and Safari I would still call this an accessibility supported issue. So using text content for the name of a combobox button can cause problems. Lastly, I don't think |
came across this issue today because we were getting similar false positives for valid use of concerning the way this issue was raised, specifically the mention of the fact that there is text within the button (combobox) - i'd have to agree with @straker that the button name test isn't appropriate to run here - particularly since it lead to this misunderstanding of what the rule is actually trying to call out:
that text is not the name of the combobox, it's the value - so it shouldn't be validated against the button name rule. |
Came across what I think is the same issue when using a label with a <label>
<button type="button" role="switch" aria-checked="true" />
Activé
</label> or <label htmlFor="button-switch">Activé</label>
<button id="button-switch" type="button" role="switch" aria-checked="true" /> or <label id="button-switch--label">Activé</label>
<button aria-labelledby="button-switch--label" type="button" role="switch" aria-checked="true" /> |
Github should not have closed this with the #4607. Guess my paragraph saying it shouldn't close this pr triggered a close. Reopening. |
### [4.10.1](v4.10.0...v4.10.1) (2024-10-16) ### Bug Fixes - **aria-allowed-role:** add form to allowed roles of form element ([#4588](#4588)) ([d462d67](d462d67)), closes [/github.com/dequelabs/axe-core/blob/develop/lib/standards/html-elms.js#L264](https://github.com/dequelabs//github.com/dequelabs/axe-core/blob/develop/lib/standards/html-elms.js/issues/L264) - **axe.d.ts:** add typings for preload options object ([#4543](#4543)) ([72e269f](72e269f)) - **button-name,input-button-name,input-img-alt:** allow label to give accessible name ([#4607](#4607)) ([364eb72](364eb72)), closes [#4472](#4472) [#3696](#3696) [#3696](#3696) - **get-ancestry:** add nth-child selector for multiple siblings of shadow root ([#4606](#4606)) ([bdd94a2](bdd94a2)), closes [#4563](#4563) - **rules:** Change "alternate text" to "alternative text" ([#4582](#4582)) ([31e0f61](31e0f61))
Product
axe-core
Product Version
4.9.1
Latest Version
Issue Description
Note: I was only allowed to select one product, but this was observed both in
axe-core
running in our Ember integration tests and in the extension in Chrome. I thought that a fix toaxe-core
may also make its way into the extension, but wanted to call this out to be sure.Expectation
The expectation is that the inner text of a
button
withrole="combobox"
would still be considered when checking for "discernible text".Actual
Currently when a
button
hasrole="combobox"
axe scans fail with the error "Buttons must have discernible text". The list of potential issues states in the first bullet point "Element does not have inner text that is visible to screen readers". This is not actually true; thebutton
has text contents.How to Reproduce
The issue can be observed here: https://codepen.io/rgallagherab/pen/JjqKKpE
This is a non-functional example, but the markup includes all required ARIA attributes and elements for
combobox
role, and no other failures relevant to the example markup (although there are 2 issues observed in the Codepen layout elements).Additional context
From what I can gather it appears that while the element should be assessed as a
combobox
role two things are true:button
to some extent considering the "Buttons must have discernible text" error is presented.axe-core
is not considering the inner text of the element as described under the "fix at least (1) of the following" list. I assume this is likely some sort of conflict in how the combination ofbutton
andcombobox
is being handled.As far as I can tell
button
should be a valid element to userole="combobox"
on. If this was not the case I'd expect to see a failure forcombobox
not being an allowed role.The text was updated successfully, but these errors were encountered: