File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 11<template >
22 <div
33 class =" vue-skip-to"
4+ ref =" skipTo"
45 :class =" { 'focused': focused }"
56 >
67 <component
1516<script >
1617import VueSkipToSingle from ' ./VueSkipToSingle.vue'
1718import VueSkipToList from ' ./VueSkipToList.vue'
19+ import { programmaticFocus } from ' ./util'
1820
1921export default {
2022 name: ' VueSkipTo' ,
@@ -40,6 +42,12 @@ export default {
4042 }
4143 },
4244
45+ mounted () {
46+ this .$route && this .$watch (' this.$route.path' , () => {
47+ this .$nextTick (() => programmaticFocus (this .$refs .skipTo ))
48+ })
49+ },
50+
4351 computed: {
4452 isList () {
4553 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