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
7 changes: 7 additions & 0 deletions .changeset/fix-snackbar-urgent-role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@vuetify/v0": patch
---

fix(Snackbar): add an `urgent` prop that switches the live region to `role="alert"` (#624)

Informational snackbars keep `role="status"` (a polite live region); setting `urgent` switches to `role="alert"` (assertive) so critical notifications interrupt assistive technology instead of waiting for it to go idle (WCAG 4.1.3, Status Messages).
6 changes: 4 additions & 2 deletions packages/0/src/components/Snackbar/SnackbarRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
namespace?: string
/** Unique identifier. Auto-generated if not provided. */
id?: ID
/** When true, sets role="alert" for urgent messages; otherwise role="status". */
urgent?: boolean
}

export interface SnackbarRootSlotProps {
Expand All @@ -61,7 +63,7 @@
default: (props: SnackbarRootSlotProps) => any
}>()

const { as = 'div', namespace = 'v0:notifications', id = useId(), renderless } = defineProps<SnackbarRootProps>()
const { as = 'div', namespace = 'v0:notifications', id = useId(), renderless, urgent } = defineProps<SnackbarRootProps>()

const queue = useSnackbarQueueContext(namespace, null)

Expand All @@ -78,7 +80,7 @@
const slotProps = toRef((): SnackbarRootSlotProps => ({
id,
attrs: {
role: 'status',
role: urgent ? 'alert' : 'status',
},
}))
</script>
Expand Down
Loading