File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 11<template >
2- <div class =" vue-skip-to" >
3- <component :is =" comp" v-bind =" props" />
2+ <div
3+ class =" vue-skip-to"
4+ :class =" { 'focused': focused }"
5+ >
6+ <component
7+ @focused =" focusWithin"
8+ @focus-within =" focusWithin"
9+ :is =" comp"
10+ v-bind =" props"
11+ />
412 </div >
513</template >
614
@@ -26,6 +34,12 @@ export default {
2634 }
2735 },
2836
37+ data () {
38+ return {
39+ focused: false
40+ }
41+ },
42+
2943 computed: {
3044 isList () {
3145 return Array .isArray (this .to )
@@ -39,6 +53,12 @@ export default {
3953 if (this .isList ) return { listLabel: this .listLabel , to: this .to }
4054 return { label: this .label , to: this .to }
4155 }
56+ },
57+
58+ methods: {
59+ focusWithin (val ) {
60+ this .focused = val
61+ }
4262 }
4363}
4464 </script >
@@ -62,7 +82,7 @@ export default {
6282 border-width : 0 ;
6383}
6484
65- .vue-skip-to :focus-within , .vue-skip-to :focus , .vue-skip-to :hover {
85+ .vue-skip-to.focused , .vue-skip-to :hover {
6686 left : 0 ;
6787 top : 0 ;
6888 clip : auto ;
Original file line number Diff line number Diff line change 1111 >
1212 <VueSkipToSingle
1313 :to =" el.anchor"
14+ @focused =" $emit('focus-within', $event)"
1415 :aria-label =" el.ariaLabel || el.label"
1516 >
1617 {{ el.label }}
Original file line number Diff line number Diff line change 22 <a
33 :href =" to"
44 @click.prevent =" handleFocusElement"
5+ @focus =" $emit('focused', true)"
6+ @blur =" $emit('focused', false)"
57 class =" vue-skip-to__link"
68 >
79 <slot >{{ label }}</slot >
You can’t perform that action at this time.
0 commit comments