Hi,
I was looking at the Alert component and I noticed it added an ARIA alert role to the component. This component may potentially not exist on page load and might be displayed dynamically.
When the component is dynamically displayed, the content is automatically announced by most screen readers. At this time, screen readers do not inform users of alerts that are present when the page loads.
The content is not always automatically announced by some screen readers though. Scott O'Hara talks about this in a post called are we live.
Dynamically injecting a live region node or changing an existing live region from display: none to display: block are effectively the same. In both cases (being absent or set to display: none) the live region does not exist in the a11y tree. Rather, as the following test cases show, ensuring an empty live region exists in your DOM, and injecting content into it when necessary, proves to be the most robust way to ensure a live region will be announced.
Severity of Alerts
Some people might not consider a success message an alert, and depending on context, info and warning might not be either. You are appending role="alert" to the component for all variants. I really think this should be revisited. At the very least mentioned in the documentation. I don't think pointing to the WAI-ARIA Authoring Practices helps here.
Hi, I was looking at the Alert component and I noticed it added an ARIA alert role to the component. This component may potentially not exist on page load and might be displayed dynamically.
In your accessibility notes for the alert component you say:
The content is not always automatically announced by some screen readers though. Scott O'Hara talks about this in a post called are we live.
Severity of Alerts
Some people might not consider a success message an alert, and depending on context, info and warning might not be either. You are appending role="alert" to the component for all variants. I really think this should be revisited. At the very least mentioned in the documentation. I don't think pointing to the WAI-ARIA Authoring Practices helps here.
Thanks.