-
Notifications
You must be signed in to change notification settings - Fork 470
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
Button's inner text is ignored when label exists, even though aria-hidden is set to true #1233
Comments
I've been looking at the error and the only thing that i see that could generate an error is the fact that instead of using a string to get the name of it you should probably try using this syntax name: /Button 1/i . |
That does not help. Did you try it with the attached cypress snippet? |
It seems like this needs to be resolved in dom-accessibility-api, specifically within |
This is a tricky one. The accessible name computation algorithm doesn't state that one specifically if I understand correctly here: What happens in dom-accessibility-api is that the label is linked to the button and since the label is hidden, the result of it is an empty string. @eps1lon do you maybe have an idea about this specific use case? I'm not sure if the screen reader behaves as it should or the browsers. |
To complicate matters, ACCNAME isn’t the only algorithm in play for accessible name computation of HTML elements, we also have HTML-AAM section 4 to contend with. Some relevant issues:
Depending on the spec you use as your starting point I’m not convinced you can potentially land with different results 😅 that may simply be me lacking ability to follow! In this specific case of a hidden
These hint at a future intention to treat a hidden |
Thanks for all the investigation on this! |
Heyho,
I have the problem that a button component has a label which has aria-hidden="true" causes findByRole to not look at the button's inner text.
In case I remove the for attribute from the label, it works as expected. But according to the accessibility tab in the browser, the label is ignored even with the for attribute set.
@testing-library/dom
version: ^8.20.0@testing-library/cypress
: ^9.0.0cypress
: ^12.3.0Relevant code or config:
What happened:
Reproduction:
See attached code snippet
The text was updated successfully, but these errors were encountered: