File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div
3
3
class =" vue-skip-to"
4
+ ref =" skipTo"
4
5
:class =" { 'focused': focused }"
5
6
>
6
7
<component
15
16
<script >
16
17
import VueSkipToSingle from ' ./VueSkipToSingle.vue'
17
18
import VueSkipToList from ' ./VueSkipToList.vue'
19
+ import { programmaticFocus } from ' ./util'
18
20
19
21
export default {
20
22
name: ' VueSkipTo' ,
@@ -40,6 +42,12 @@ export default {
40
42
}
41
43
},
42
44
45
+ mounted () {
46
+ this .$route && this .$watch (' this.$route.path' , () => {
47
+ this .$nextTick (() => programmaticFocus (this .$refs .skipTo ))
48
+ })
49
+ },
50
+
43
51
computed: {
44
52
isList () {
45
53
return Array .isArray (this .to )
Original file line number Diff line number Diff line change
1
+ export function programmaticFocus ( el ) {
2
+ el . setAttribute ( 'tabindex' , '-1' )
3
+ el . focus ( )
4
+ el . removeAttribute ( 'tabindex' )
5
+ }
You can’t perform that action at this time.
0 commit comments