Alert messages



Alert messages are a special case of notification messages that are used to report a critical error or warning.

They grab the reader’s attention through a short message that is displayed all at once on the screen, without reloading the page or interrupting the activity.

This code is based on the “Alert” design pattern found in ARIA Authoring Practices Guide (APG) of the W3C.

Core HTML base

When the page is loaded

<div role="alert"></div>

When the alert is triggered

<div role="alert">
<p>Seating may not be available on this trip.</p>

ARIA roles, states and properties

The role="alert" attribute must be applied to the container of the alert message.

Expected behavior

The role="alert" attribute must be statically present when the page is loaded.

This container must then be dynamically populated when the alert is triggered.


Alert messages must not disappear automatically from the screen after a certain time.

They must disappear only following a deliberate action by the user (closing “X”, display of a new page, etc.).


Back to top