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

Modal content outside ARIA landmark #140

Open
peterh-capella opened this issue Feb 16, 2022 · 2 comments
Open

Modal content outside ARIA landmark #140

peterh-capella opened this issue Feb 16, 2022 · 2 comments

Comments

@peterh-capella
Copy link

The default behavior of injecting the div.modaal-wrapper at the end of the body has the side-effect of removing the content therein from any ARIA landmarks defined on the page. This limits the ability of assistive technologies to navigate to the content and also causes failures in automated accessibility checks.

I suggest checking for the presence of one of the tags with an implicit ARIA landmark role as parent of the modal content and inserting the div.modaal-wrapper element at the end of that element, falling back to current behavior if such an element is not present.

I'm willing to work on developing this update if it seems valuable to the project.

@danhumaan
Copy link
Collaborator

hi @peterh-capella thanks for raising the issue. This version of Modaal is no longer being worked, with a new non-jquery dependant version being planned.

Rather than you invest time in applying it to this version, if you're able to share the steps you've used to identify and test the issue, we can apply that approach to the new version when it's further along

@peterh-capella
Copy link
Author

peterh-capella commented Feb 17, 2022

The issue came up for me due to my firm's use of the Siteimprove service (https://siteimprove.com/). Their recent updates to their testing engine flagged many instances of a best-practice issue, "Text not included in an ARIA landmark." This would show up for applications that included an introductory modal describing the academic activity the user was starting. We have standard pattern of opening that modal on page load which then injects the HTML structure at the end of the <body>. This removes the content from the <main> landmark, leaving it outside of any landmark and thus failing the test. You can see this on the Modaal demo page by opening one of the examples and the using their Chrome extension.

My plan to remediate this was to look into where the script built the div.modaal-wrapper and associated HTML structure and prior to that see if the content defined either by the trigger's href or content_source existed inside one of the elements with implicit ARIA landmark roles (<header>, <footer>, <main>, <nav>, <aside>, <form> or <section>). Then build the existing HTML structure inside that element. Complications I see arising from this are the styling of the modal position based on the parent.

Another option would be to use a <section> as the outer wrapper of the modal structure. That would require giving the region an accessible name, most likely through an aria-label attribute, which presents complications of naming and localization.

I hope that's useful. If I can assist with the new version let me know.

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

No branches or pull requests

2 participants