-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[core] Replace toBeAriaHidden
matcher with toBeInaccessible
in tests
#43870
[core] Replace toBeAriaHidden
matcher with toBeInaccessible
in tests
#43870
Conversation
Netlify deploy previewhttps://deploy-preview-43870--material-ui.netlify.app/ Bundle size report |
toBeAriaHidden
matcher with toBeInaccessible
toBeAriaHidden
matcher with toBeInaccessible
toBeAriaHidden
matcher with toBeInaccessible
in tests
for (let i = 1; i < numberOfChildren; i += 1) { | ||
expect(container2.children[i]).not.toBeAriaHidden(); | ||
expect(container2.children[i].getAttribute('aria-hidden')).to.equal(null); |
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.
Unique case where we cannot use .not.toBeInaccessible
assertion. Some elements in the forbidden list like <template>, <script>, <style>, <noscript>
etc are implicitly inaccessible in the accessibility tree due to display: 'none'
being applied implicitly. Other elements like <map>
, <col>
, <colgroup>
etc are accessible.
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.
Makes sense to me 👍
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.
nice!
toBeAriaHidden
is marked as deprecated, so replaced it withtoBeInaccessible
. This change makes sense sincetoBeInaccessible
checks more than just thearia-hidden
attribute — it also accounts for other factors that determine if an element should be excluded from the accessibility tree. It uses the DOM Testing Library'sisInaccessible
method internally.Additionally,
toBeAriaHidden
has been removed from the matchers list since it is not used in MUI X, Toolpad, or Pigment CSS.