Semantics
A type of live region with important, and usually time-sensitive, information.
Additional info from the ARIA specification
See related alertdialog and status.
Alerts are used to convey messages that will be immediately important to users. In the case of audio warnings, visibly displayed alerts provide an accessible alternative to audible alerts for Deaf or hard-of-hearing users. Likewise, alerts can provide an accessible alternative to the visible alerts for blind, deaf-blind, or low-vision users, and others with certain developmental disabilities. The alert role is applied to the element containing the alert message.
Alert is a special type of assertive live region that is intended to cause immediate notification for assistive technology users. If the operating system allows, the user agent SHOULD fire a system alert event through the accessibility API when the alert is rendered.
Neither authors nor user agents are required to set or manage focus to an alert in order for it to be processed. Since alerts are not required to receive focus, authors SHOULD NOT require users to close an alert. If an author desires focus to move to a message when it is conveyed, the author SHOULD use alertdialog instead of alert.
Elements with the role alert have an implicit aria-live value of assertive, and an implicit aria-atomic value of true.
Abstract Role
Live RegionRepresents dynamic content or an announcement, typically updated as a result of an external event when user focus may be elsewhere.
Content Categories
Flow ContentAn element that structures and organizes the body of a web document.
Allowed Descendants
Flow Children Allowed
No main element descendants allowed.
Usage
Allowed HTML elements
Implicit semantics
- None
Explicitly allowed
section[role=alert]
Elements that can have any role
abbr[role=alert]address[role=alert]b[role=alert]blockquote[role=alert]canvas[role=alert]cite[role=alert]code[role=alert]custom-element[role=alert]data[role=alert]del[role=alert]dfn[role=alert]div[role=alert]em[role=alert]figure[role=alert]i[role=alert]ins[role=alert]kbd[role=alert]mark[role=alert]output[role=alert]p[role=alert]pre[role=alert]q[role=alert]samp[role=alert]small[role=alert]span[role=alert]table[role=alert]tbody[role=alert]tfoot[role=alert]thead[role=alert]time[role=alert]u[role=alert]var[role=alert]