You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trigger a Toast by clicking any "Show toast"-button
What did you expect to happen, and what happened instead?
Contents of the Toast should be be announced by the screen reader, instead nothing happens.
Additional info
The Toast does have role="status" and aria-atomic="true" which means it should be announced by screen readers.
I believe the bug is caused by the Toast container and contents being injected into the DOM at the same time, because if you first add the Toast to DOM and then change the contents afterwards it will be correctly announced by the screen reader.
Working example (but not a good solution to the problem):
exportconstBaseToast=({ children, variant, id }: BaseToastProps)=>{conststyles=useStyleConfig("Toast",{ variant });const[content,setContent]=useState<any>('')setTimeout(()=>{setContent(children)// <-- Force contents to change after toast container has been added to DOM},0)return(<Flexsx={styles}id={id}><ToastIconvariant={variant}/>{content}</Flex>);};
The text was updated successfully, but these errors were encountered:
What's wrong?
Toast messages aren't announced by screen readers (WCAG 4.1.3 failure).
How to reproduce?
Steps to reproduce the behavior:
What did you expect to happen, and what happened instead?
Contents of the Toast should be be announced by the screen reader, instead nothing happens.
Additional info
The Toast does have
role="status"
andaria-atomic="true"
which means it should be announced by screen readers.I believe the bug is caused by the Toast container and contents being injected into the DOM at the same time, because if you first add the Toast to DOM and then change the contents afterwards it will be correctly announced by the screen reader.
Working example (but not a good solution to the problem):
The text was updated successfully, but these errors were encountered: