Screenshot of the visual appearance of Drupal messages alongside the generated markup with the additional ARIA role and label attributes

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This module adds an ARIA landmark role and aria-label attributes to the default Drupal messages output for errors, warnings, and status messages. These attributes help prompt assistive technology (AT) such as screen readers to announce these errors on the page load (or introduction of the error to the DOM for messages introduced by AJAX). This announcement serves as an equivalent of the message being prominent to sighted users through colouring and position at the top of the page.

The module backports some of the accessibility work done by jessebeach which is part of the core messages template in Drupal 8.

Changes to the default output

  1. The messages container div now has an ARIA landmark set: role="contentinfo" as well as an appropriate label set, such as: aria-label="Error message".
  2. Error or status messages are wrapped in an additional div and given an appropriate ARIA role attribute such as role="alert" or role="status"

Project information