Skip to content

Modal dialogs don't set aria-modal, so alert dialogs fail axe page-level checks #19251

Closed

Description

@gtritchie

RStudio's modal dialogs block the rest of the IDE: while one is showing, ModalDialogTracker makes the main window inert and aria-hidden (ModalDialogTracker.java#L162). None of them set aria-modal="true", so the dialog itself doesn't tell assistive technology that it's modal. aria-modal isn't set anywhere in the GWT code.

One visible effect: with an alertdialog open, such as "Do you trust this project?" or any MessageDialog box, an axe DevTools full-page scan reports:

  • Document should have one main landmark
  • Page should contain a level-one heading

axe passes those two rules whenever it detects an open modal, but its detection (isModalOpen in axe-core 4.13) only matches dialog, [role=dialog], [aria-modal=true]. Dialogs with role="dialog" (Global Options, About) are detected, so the rules pass. A role="alertdialog" without aria-modal isn't, so axe checks the page behind the dialog, where the main landmark is hidden. Adding aria-modal="true" to the trust dialog in the DOM makes both rules pass.

Affected: every dialog or alertdialog registered with ModalDialogTracker:

  • ModalDialogBase subclasses, including MessageDialog (MessageDialog.java#L47), which backs the GlobalDisplay message and confirmation boxes, plus TrustRequestDialog, ClearAllDialog, UnsavedChangesDialog, JobQuitDialog, LoggedOutDialog, and others
  • ApplicationEndedPopupPanel (alertdialog)
  • the command palette (a ModalPopupPanel with role="dialog")

A fix would have ModalDialogTracker.onShow set aria-modal="true" on panels whose role is dialog or alertdialog.

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions