vue-announcer
Imagine browsing pages (routes), receiving alerts and notifications, having a countdown timer on the page, a progress bar or a loading, among others. Now imagine all this happening to people who have visual disabilities and who use screen readers.
The idea of this plugin is to tell the screen reader what is happening and primarily if you use single-page application.
Install package
NPM
Yarn
How to use
In your main.js
In your App.vue
Example using vue-toasted
See this example:
Example link
Announce route changes
For page changes (routes) to be announced automatically, you only need to pass the router object as a parameter at the time of installation.
Options
Key | Data Type | default |
---|---|---|
complementRoute |
String | has loaded |
Example:
Custom message to each page (optional)
You can set a property on the meta object, which will serve as information to get the message that will be announced to the screen reader on each page. e.g.:
When the page loads, the screen reader user will hear:
Note:
- The plugin checks whether it was defined in the meta object, otherwise, without any problems, the title of the page being loaded will be used.
- The vue-announcer uses the global after hooks
router.afterEach
to announce the route changes.
Run the tests
Or run Cypress on interactive mode
It is a simple webpack template already installed and configured.
After the commands just access the http://localhost:8080/