-
Notifications
You must be signed in to change notification settings - Fork 468
feat: Export isInaccessible #364
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
feat: Export isInaccessible #364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure of the best name either. Maybe simply isHidden
?
What do you think about
|
🤔 Could include the word ARIA in the name to indicate its relationship to that spec: |
It's really just an implementation of "Excluding Elements from the Accessibility Tree". I thought about the name for a bit but I would just punt the name towards spec folks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this. I don't really mind the name all that much 🤷♂️ I don't expect many people will use this API.
lol, actually, I think I like |
Ok let's go with that. |
75890ed
to
ea42a4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super. thanks!
🎉 This PR is included in version 6.8.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Looking for better names of this function.
What:
byRoles
queries to exclude inaccessible elementsWhy:
To implement a custom test matcher like
expect(element).toBeInaccessible()
This is useful if you want to test relationships between elements which are established via
aria-controls
. We want to test that the value ofaria-controls
is valid by checking thatexpect(document.getElementById(control.getAttribute('aria-controls'))).toBeInTheDocument()
but we want to make sure that at that point the element is still excluded from the a11y tree.Another use case might be if you queried the element with something other than
byRole
and you want to make sure the element is (in)accessible.How:
Checklist:
docs site