We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fdea86d commit 4c5d4bcCopy full SHA for 4c5d4bc
src/VueSkipTo.vue
@@ -1,6 +1,7 @@
1
<template>
2
<div
3
class="vue-skip-to"
4
+ ref="skipTo"
5
:class="{ 'focused': focused }"
6
>
7
<component
@@ -15,6 +16,7 @@
15
16
<script>
17
import VueSkipToSingle from './VueSkipToSingle.vue'
18
import VueSkipToList from './VueSkipToList.vue'
19
+import { programmaticFocus } from './util'
20
21
export default {
22
name: 'VueSkipTo',
@@ -40,6 +42,12 @@ export default {
40
42
}
41
43
},
44
45
+ mounted () {
46
+ this.$route && this.$watch('this.$route.path', () => {
47
+ this.$nextTick(() => programmaticFocus(this.$refs.skipTo))
48
+ })
49
+ },
50
+
51
computed: {
52
isList () {
53
return Array.isArray(this.to)
src/util.js
@@ -0,0 +1,5 @@
+export function programmaticFocus (el) {
+ el.setAttribute('tabindex', '-1')
+ el.focus()
+ el.removeAttribute('tabindex')
+}
0 commit comments