Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/ui-alerts/src/Alert/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ type: embed
<Figure.Item>aria-live="polite" alerts will only be announced if the user is not currently doing anything. Polite should be used in most situations involving live regions that present new info to users</Figure.Item>
<Figure.Item>aria-live="assertive" alerts will be announced to the user as soon as possible, but not necessarily immediately. Assertive should be used if there is information that a user must know about right away, for example, a warning message in a form that does validation on the fly</Figure.Item>
<Figure.Item>The aria-atomic=BOOLEAN is used to set whether or not the screen reader should always present the live region as a whole, even if only part of the region changes. The possible settings are: false or true. The default setting is false.</Figure.Item>
<Figure.Item>If the `liveRegion` element has a `role`, match it to the `liveRegionPoliteness` level: use `role="status"` for `polite` and `role="alert"` for `assertive`.</Figure.Item>

@matyasf matyasf Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this is not the best description, its more complicated. Please add this:

<Figure.Item>
For the liveRegion DOM element, note that the role prop adds implicit ARIA attributes, but these are not applied, unless you set liveRegionPoliteness or isLiveRegionAtomic to undefined.
</Figure.Item>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matyasf liveRegionPoliteness and isLiveRegionAtomic both have default values.

65    static defaultProps = {
...
72      liveRegionPoliteness: 'assertive', 
73      isLiveRegionAtomic: false,
...
76    }

So aria-live and aria-atomic are always explicitly set even if these props are undefined, e.g.:

<div>
  <div className="alerts-container" id="live-region"></div>
  <Alert
    variant="info"
    renderCloseButtonLabel="Dismiss alert"
    liveRegion={() => document.getElementById("live-region")}
  >
    Just an alert.
  </Alert>
</div>

</Figure>
</Guidelines>
```
5 changes: 0 additions & 5 deletions packages/ui-alerts/src/Alert/v2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ class Alert extends Component<AlertProps, AlertState> {
}

initLiveRegion(liveRegion: Element) {
error(
liveRegion.getAttribute('role') === 'alert',
`[Alert] live region must have role='alert' set on page load in order to announce content`
)

if (liveRegion) {
liveRegion.setAttribute('aria-live', this.props.liveRegionPoliteness!)
// indicates what notifications the user agent will trigger when the
Expand Down
Loading