Skip to content

Conversation

@linyuqing222
Copy link

This pull request introduces a new feature that enables the Inertia.js router to automatically announce page titles during navigation, similar to how vue-router operates with vue-announcer.

The changes primarily involve modifications to Announcer.vue, where we now check if the router object has an 'afterEach' method (indicative of vue-router) or an 'on' method (indicative of Inertia router). Depending on the method available, the router will announce the page title on each navigation event.

Here's a usage example with Inertia:

import { createApp } from 'vue'
import App from './App.vue'
import { router } from '@inertiajs/vue3'
import VueAnnouncer from '@vue-a11y/announcer'
import '@vue-a11y/announcer/dist/index.css'

createApp(App)
  .use(VueAnnouncer, { router })
  .mount('#app')
// Page title is announced automatically

I'm not sure how to better implement this feature with Inertia...
Looking forward to your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant