Skip to content
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

[@mantine/hooks] use-focus-trap: Fix aria-hidden #2735

Merged
merged 3 commits into from Oct 22, 2022

Conversation

Keilo75
Copy link
Contributor

@Keilo75 Keilo75 commented Oct 18, 2022

This PR resolves #2726.

Turns out that restoreAria.current(); was simply not called on unmount; this has now been changed.
Furthermore, I fixed an additional issue where aria-hidden attributes would only be applied on the first render, but would not update after that. This was caused by

if (node === ref.current || node === null) {
After the first render, ref.current would already hold the node and aria attributes would not be reapplied again.

Finally, I added a test to FocusTrap.test.tsx which makes sure aria-hidden is added and removed. I'll be the first to admit it is kinda ugly but I could not find a better version. Also tested it manually with storybook - components like Modal or Drawer now remove the attribute correctly.

@rtivital rtivital merged commit 2599b47 into mantinedev:master Oct 22, 2022
@rtivital
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FocusTrap not removing aria-hidden attribute
2 participants