Usage
From Rivet Design System Alerts
Alerts are used to display brief important messages to users. They are designed to attract the user’s attention, but not interrupt their work.
Load alerts via static HTML or server side scripting over javascript whenever possible. For dismissable alerts, do not auto remove; give people the ability to dismiss the alert. Dismissable alerts and alerts that are dynamically added to the content after page load must have appropriate accessibility attributes outlined below.
When to use
- To notify people about system status including error, warnings, and updates.
- To notify people they’ve successfully completed a task.
- Use along with inline validation alerts to summarize multiple errors on longer forms.
When to use something else
- When it’s necessary to interrupt the person’s workflow.
- When input/action is required to continue working.
- If action taken by the person will result in losing/destroying their work, require confirmation.
Accessibility
- Use the
role="alert"
attribute. - Alerts that have a dismiss or close button use the
role="alertdialog"
attribute. - Use the
aria-labelledby
attribute to link the alert title with the alert element. - Dynamically rendered alerts are automatically announced by most screen readers; note that screen readers will not inform people of alerts that are present before a page has finished loading.
Alert list accessibility
Alert lists can be particularly useful for summarizing multiple errors on a page, and providing links to the invalid fields. These summaries are especially helpful for people with visual impairments, who will not receive the visual cue provided by multiple inline alerts appearing on the page when a form is submitted.
Microcopy
- Alert title is clear and concise. “Success” rather than “Application was submitted successfully”
- Alert message is descriptive and clearly articulates the problem encountered or the information needing conveyance. “The user ID and password you entered do not match” is more clear than “Unauthorized”.
- Where appropriate, alert title is a link to the position on the page where the invalid element can be found.
- Alert message ideally provides next steps where appropriate.
Example
Scheduled system maintenance
The system will be unavailable on August 1st due to scheduled system maintenance. Access to databases will continue.
(good copy)
System is down
The system is currently unavailable.
(bad)
Notes
- Avoid using error messages that automatically disappear.
- Write helpful alert messages. For errors, include a brief description of the problem and how to fix it.