|
1 |
| -# vue-axe-next |
2 |
| -[WIP] Dynamic accessibility analysis for Vue.js 3 using axe-core |
| 1 | + |
| 2 | +<p align="center"> |
| 3 | + <img src="vue-axe.svg" alt="Vue Axe logo"> |
| 4 | +</p> |
| 5 | + |
| 6 | +## vue-axe (WIP) |
| 7 | +Accessibility auditing for Vue.js 3 applications by running [dequelabs/axe-core](https://github.com/dequelabs/axe-core/) validation on the page you're viewing. |
| 8 | + |
| 9 | +**NOTE: It is still a beta version. You can create an [issue](https://github.com/vue-a11y/vue-axe-next/issues) if you encounter any errors or want to add some functionality.** |
| 10 | + |
| 11 | +- [Links](#links) |
| 12 | +- [Setup](#setup) |
| 13 | +- [Options](#options) |
| 14 | +- [Locales](#locales) |
| 15 | + |
| 16 | +## Links |
| 17 | +- [Demo](https://vue-axe-next.surge.sh/) |
| 18 | + |
| 19 | +## Setup |
| 20 | +```shell |
| 21 | +npm install -D axe-core [email protected] |
| 22 | +# or |
| 23 | +yarn add -D axe-core [email protected] |
| 24 | +``` |
| 25 | + |
| 26 | +### Vue CLI |
| 27 | +```js |
| 28 | +import { createApp, h } from 'vue' |
| 29 | +import App from './App.vue' |
| 30 | + |
| 31 | +let app = null |
| 32 | + |
| 33 | +if (process.env.NODE_ENV === 'development') { |
| 34 | + const VueAxe = require('vue-axe') |
| 35 | + app = createApp({ |
| 36 | + render: () => h('div', {}, [h(App), h(VueAxe.VueAxePopup)]) |
| 37 | + }) |
| 38 | + app.use(VueAxe.default) |
| 39 | +} else { |
| 40 | + app = createApp(App) |
| 41 | +} |
| 42 | + |
| 43 | +app.mount('#app') |
| 44 | +``` |
| 45 | + |
| 46 | +## Options |
| 47 | + |
| 48 | +### auto |
| 49 | + |
| 50 | +| Type | Default | |
| 51 | +| -------- | -------- | |
| 52 | +| Boolean | `true` | |
| 53 | + |
| 54 | +If false disables automatic verification. |
| 55 | +It is necessary to click on `run again` for a new analysis. |
| 56 | + |
| 57 | +### config |
| 58 | + |
| 59 | +| Type | Default | |
| 60 | +| -------- | ---------------------------------------- | |
| 61 | +| Object | `{ branding: { application: 'vue-axe' }` | |
| 62 | + |
| 63 | +To configure the format of the data used by axe. |
| 64 | +This can be used to add new rules, which must be registered with the library to execute. |
| 65 | + |
| 66 | +NOTE: Learn more about [Axe-core configuration](https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure) |
| 67 | + |
| 68 | +### runOptions |
| 69 | + |
| 70 | +| Type | Default | |
| 71 | +| -------- | --------------------------------------------------------------- | |
| 72 | +| Object | `{ runOptions: { reporter: 'v2', resultTypes: ['violations'] }` | |
| 73 | + |
| 74 | +Flexible way to configure how `axeCore.run()` operates. |
| 75 | + |
| 76 | +NOTE: Learn more about [Axe-core runtime options](https://github.com/dequelabs/axe-core/blob/master/doc/API.md#options-parameter) |
| 77 | + |
| 78 | +### plugins |
| 79 | + |
| 80 | +| Type | |
| 81 | +| -------- | |
| 82 | +| Array | |
| 83 | + |
| 84 | +Register Axe plugins. |
| 85 | + |
| 86 | +```js |
| 87 | +const plugins = require('@/plugins/axe') |
| 88 | +app.use(VueAxe, { |
| 89 | + plugins: [plugins.myPlugin, plugins.myPlugin2] |
| 90 | +}) |
| 91 | +``` |
| 92 | + |
| 93 | +## Locales |
| 94 | + |
| 95 | +Through the settings it is possible to define the language that will be used for the violations. |
| 96 | + |
| 97 | +NOTE: axe-core already has several languages available. |
| 98 | +[See axe-core locales](https://github.com/dequelabs/axe-core/tree/develop/locales) |
| 99 | + |
| 100 | +```js |
| 101 | +const ptBR = require('axe-core/locales/pt_BR.json') |
| 102 | +app.use(VueAxe, { |
| 103 | + config: { |
| 104 | + locale: ptBR |
| 105 | + } |
| 106 | +}) |
| 107 | +``` |
| 108 | + |
| 109 | +## Contributing |
| 110 | +- From typos in documentation to coding new features; |
| 111 | +- Check the open issues or open a new issue to start a discussion around your feature idea or the bug you found; |
| 112 | +- Fork repository, make changes and send a pull request; |
| 113 | + |
| 114 | +Follow us on Twitter [@vue_a11y](https://twitter.com/vue_a11y) |
| 115 | + |
| 116 | +**Thank you** |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
0 commit comments