From ceb90830b0b27020d8538e2122c0df3c20b9ce15 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 6 Feb 2024 16:18:33 -0500 Subject: [PATCH 1/3] docs(toast): clarify toasts from overlays --- docs/api/toast.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/toast.md b/docs/api/toast.md index 6e49ee25bdc..d9d4581b493 100644 --- a/docs/api/toast.md +++ b/docs/api/toast.md @@ -208,6 +208,10 @@ While this is not a complete list, here are some guidelines to follow when using * For toasts with long messages, consider adjusting the `duration` property to allow users enough time to read the content of the toast. +* If adding buttons to a toast, always provide alternative ways of completing the actions associated with each button. This ensures that even if the toast dismisses before a user can read it, they can still complete the actions shown in the toast. + +* Avoid showing a toast with buttons from inside another overlay such as a [modal](./modal). Other overlays implement [focus trapping](./modal#focus-trapping) that will prevent screen readers from moving focus to the toast to complete the actions. This may be confusing for users since the toast will still be announced by screen readers. This is true even if alternative ways of completing the actions associated with each button are implemented. + ## Interfaces ### ToastButton From 56738fc6a3643486ed32b7f22211e78b29dd453e Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 7 Feb 2024 09:26:33 -0500 Subject: [PATCH 2/3] Update docs/api/toast.md Co-authored-by: Brandy Carney --- docs/api/toast.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/toast.md b/docs/api/toast.md index d9d4581b493..3c5cd54381c 100644 --- a/docs/api/toast.md +++ b/docs/api/toast.md @@ -210,7 +210,7 @@ While this is not a complete list, here are some guidelines to follow when using * If adding buttons to a toast, always provide alternative ways of completing the actions associated with each button. This ensures that even if the toast dismisses before a user can read it, they can still complete the actions shown in the toast. -* Avoid showing a toast with buttons from inside another overlay such as a [modal](./modal). Other overlays implement [focus trapping](./modal#focus-trapping) that will prevent screen readers from moving focus to the toast to complete the actions. This may be confusing for users since the toast will still be announced by screen readers. This is true even if alternative ways of completing the actions associated with each button are implemented. +* Avoid showing a toast with buttons from inside another overlay such as a [modal](./modal). Modals and other overlays implement [focus trapping](./modal#focus-trapping) that will prevent screen readers from moving focus to the toast to complete the actions. This may be confusing for users since the toast will still be announced by screen readers. This is true even if alternative ways of completing the actions associated with each button are implemented. ## Interfaces From d83214df8fbb9544cfebc0f3fae32f2321b82685 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 7 Feb 2024 09:27:45 -0500 Subject: [PATCH 3/3] Update toast.md --- docs/api/toast.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/toast.md b/docs/api/toast.md index 3c5cd54381c..f9a5db93021 100644 --- a/docs/api/toast.md +++ b/docs/api/toast.md @@ -210,7 +210,7 @@ While this is not a complete list, here are some guidelines to follow when using * If adding buttons to a toast, always provide alternative ways of completing the actions associated with each button. This ensures that even if the toast dismisses before a user can read it, they can still complete the actions shown in the toast. -* Avoid showing a toast with buttons from inside another overlay such as a [modal](./modal). Modals and other overlays implement [focus trapping](./modal#focus-trapping) that will prevent screen readers from moving focus to the toast to complete the actions. This may be confusing for users since the toast will still be announced by screen readers. This is true even if alternative ways of completing the actions associated with each button are implemented. +* Avoid showing a toast with buttons from inside another overlay such as a [modal](./modal). Modals and other overlays implement [focus trapping](./modal#focus-trapping) that will prevent screen readers from moving focus to the toast to complete the actions. This may be confusing for users since the toast will still be announced by screen readers. This is true even if alternative ways of completing the actions associated with each button are implemented. Consider creating a [live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) within the focus-trapped modal instead of using a toast. ## Interfaces