A composable which observes the page title changes and updates the announcer message accordingly. Used by <NuxtRouteAnnouncer> and controllable.
It hooks into Unhead's dom:rendered to read the page's title and set it as the announcer message.
politeness: Sets the urgency for screen reader announcements: off (disable the announcement), polite (waits for silence), or assertive (interrupts immediately). (default polite).messageRef<string>politenessRef<string>off, polite, or assertiveset(message, politeness = "polite")Sets the message to announce with its urgency level.
polite(message)Sets the message with politeness = "polite"
assertive(message)Sets the message with politeness = "assertive"
<script setup lang="ts">
const { message, politeness, set, polite, assertive } = useRouteAnnouncer({
politeness: 'assertive',
})
</script>