Skip to content

Instantly share code, notes, and snippets.

@newbornfrontender
Created October 16, 2018 11:33
Show Gist options
  • Save newbornfrontender/8a96eecd54fe77a13034cb5b9e096b4d to your computer and use it in GitHub Desktop.
Save newbornfrontender/8a96eecd54fe77a13034cb5b9e096b4d to your computer and use it in GitHub Desktop.
Vue accessibility (vue-axe)
<template>
<div id="app">
<div id="nav">
<router-link
to="/"
title="Go to home page (title)"
aria-label="Go to home page (aria)"
>Home</router-link> |
<router-link
to="/about"
title="Go to about page (title)"
aria-label="Go to about page (aria)"
>About</router-link>
</div>
<!-- role="main" fix problem -->
<div role="main">
<router-view/>
</div>
</div>
</template>
<style>
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import VueAxe from "vue-axe"; // Only dev mode
Vue.config.productionTip = false;
Vue.use(VueAxe, {
config: {
rules: [
{ id: 'heading-order', enabled: true },
{ id: 'label-title-only', enabled: true },
{ id: 'link-in-text-block', enabled: true },
{ id: 'region', enabled: true },
{ id: 'skip-link', enabled: true },
{ id: 'help-same-as-label', enabled: true }
]
}
})
new Vue({
router,
render: h => h(App)
}).$mount("#app");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment