I've found that by default the package adds aria-hidden="true" on body element, which makes the whole page inaccessible because modal dialog is placed inside of body. According to specification (https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_roles_states_props) aria-hidden is not needed at all as aria-modal="true" already prevents users of assistive technologies from perceiving content outside the dialog.
Because of this 'aria-hidden' attribute it is easy to make a modal completelly inaccessible by mistake, if a user doesn't call .setAppElement with a container that is not a body. Why the package adds this attribute, if it is not required by specification?
body doens't have such an attribute.
Hi @Julia1996, yes...it's true. I would like to remove the default in this case, but I don't know if it would break someone's code.
If we are going to do something about this, it think the right way is to bump a major version to treat as a breaking change.
Also, I'd love to hear other opinions regarding this issue.
We just came across this issue _sort of_ as some of our devs were passing html to setAppElement.
The problem we're now encountering is that the way our site is laid out, passing only one element id will not solve our problem. If we have a layout similar to something below, we'd need to pass an array of ids in order to have expected accessibility behavior.
<body>
<header id="someheader"></header>
<main id="somemain"></main>
<footer id="somefooter"></footer>
</body>
@LeeroyJenks This is available on the latest version.
Both appElement on the component and setAppElement can receive a list of elements to hide.