File tree 3 files changed +26
-3
lines changed
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1
1
<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
+ />
4
12
</div >
5
13
</template >
6
14
@@ -26,6 +34,12 @@ export default {
26
34
}
27
35
},
28
36
37
+ data () {
38
+ return {
39
+ focused: false
40
+ }
41
+ },
42
+
29
43
computed: {
30
44
isList () {
31
45
return Array .isArray (this .to )
@@ -39,6 +53,12 @@ export default {
39
53
if (this .isList ) return { listLabel: this .listLabel , to: this .to }
40
54
return { label: this .label , to: this .to }
41
55
}
56
+ },
57
+
58
+ methods: {
59
+ focusWithin (val ) {
60
+ this .focused = val
61
+ }
42
62
}
43
63
}
44
64
</script >
@@ -62,7 +82,7 @@ export default {
62
82
border-width : 0 ;
63
83
}
64
84
65
- .vue-skip-to :focus-within , .vue-skip-to :focus , .vue-skip-to :hover {
85
+ .vue-skip-to.focused , .vue-skip-to :hover {
66
86
left : 0 ;
67
87
top : 0 ;
68
88
clip : auto ;
Original file line number Diff line number Diff line change 11
11
>
12
12
<VueSkipToSingle
13
13
:to =" el.anchor"
14
+ @focused =" $emit('focus-within', $event)"
14
15
:aria-label =" el.ariaLabel || el.label"
15
16
>
16
17
{{ el.label }}
Original file line number Diff line number Diff line change 2
2
<a
3
3
:href =" to"
4
4
@click.prevent =" handleFocusElement"
5
+ @focus =" $emit('focused', true)"
6
+ @blur =" $emit('focused', false)"
5
7
class =" vue-skip-to__link"
6
8
>
7
9
<slot >{{ label }}</slot >
You can’t perform that action at this time.
0 commit comments