Skip to content

Commit

Permalink
fix(Toast): screen readers announcing toasts (#1551)
Browse files Browse the repository at this point in the history
aria-atomic attribute specifically needs the "true" value to be read by screen readers, and VoiceOver requires the role "alert" for some reason
  • Loading branch information
nicooprat authored Jan 14, 2025
1 parent 194bf4b commit 6c49099
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/radix-vue/src/Toast/ToastRootImpl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ provideToastRootContext({ onClose: handleClose })
<template>
<ToastAnnounce
v-if="announceTextContent"
role="status"
role="alert"
:aria-live="type === 'foreground' ? 'assertive' : 'polite'"
aria-atomic
aria-atomic="true"
>
{{ announceTextContent }}
</ToastAnnounce>
Expand All @@ -183,9 +183,9 @@ provideToastRootContext({ onClose: handleClose })
>
<Primitive
:ref="forwardRef"
role="status"
role="alert"
aria-live="off"
aria-atomic
aria-atomic="true"
tabindex="0"
data-radix-vue-collection-item
v-bind="$attrs"
Expand Down

0 comments on commit 6c49099

Please sign in to comment.