Modal dialogs cause axe to throw landmark-one-main and page-has-heading-one #3359
Labels
best practice
fix
Bug fixes
pr
A pr has been created for the issue
rules
Issue or false result from an axe-core rule
Milestone
Product: axe-core 4.3.5
Expectation: Common implementations of modal dialogs do not cause axe to throw landmark-one-main or page-has-heading-one issues.
Actual: Modal dialogs typically cause axe to throw landmark-one-main and page-has-heading-one issues.
Motivation: It is common and valid to implement modal dialogs that use role=dialog or alertdialog by instantiating the dialog outside of the main DOM tree of the page, while setting that non-dialog portion of the page to be aria-hidden=true. This implementation allows for the user to make everything on the page, other than the currently displaying dialog, inert and inaccessible to a screen reader.
Axe ignores the content in the aria-hidden portion of the page and runs only against the non-hidden/accessible contents of the dialog. Because of this, it sees the page has no main landmark and no heading level one and surfaces landmark-one-main and page-has-heading-one issues.
If axe were to suppress those rules for "window" containers with role=dialog or role=alertdialog, those issues would not occur. ARIA Authoring Practices do not recommend dialogs have an H1 or contain a main landmark.
An example of these issues occurring is here.
To reproduce:
See issue #2556 as motivation for this.
The text was updated successfully, but these errors were encountered: