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
Improve accessibility #26
Conversation
src/useOverlay.tsx
Outdated
document.getElementById(rootElementId)?.setAttribute('aria-hidden', 'true'); | ||
document.body.addEventListener('keydown', handleKeydown); | ||
|
||
return () => { | ||
document.getElementById(rootElementId)?.removeAttribute('aria-hidden'); | ||
document.body.removeEventListener('keydown', handleKeydown); | ||
}; |
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.
document.getElementById(rootElementId)?.setAttribute('aria-hidden', 'true'); | |
document.body.addEventListener('keydown', handleKeydown); | |
return () => { | |
document.getElementById(rootElementId)?.removeAttribute('aria-hidden'); | |
document.body.removeEventListener('keydown', handleKeydown); | |
}; | |
document.body.addEventListener('keydown', handleKeydown); | |
return () => { | |
document.body.removeEventListener('keydown', handleKeydown); | |
}; |
Since aria-hidden="true"
will be added to the entire root to be mounted, and the modal itself will be hidden, this description should not be used for accessibility reasons.
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.
Ok, I'll remove it and remove rootElementId
from the arguments of this hook.
Co-authored-by: Okuto Oyama <0910yama@gmail.com>
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.
Looks nice!
@dqn Could you resolve the conflict? |
…into accessibility
@shibe97 It's done! |
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.
Thanks.
Just a proposal