File tree 2 files changed +33
-5
lines changed
2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,28 @@ const props = defineProps<{
11
11
large? : true
12
12
match? : boolean
13
13
target? : string
14
+ button? : boolean
14
15
}>()
15
16
17
+ defineEmits <{
18
+ (event : ' click' ): void
19
+ }>()
20
+
21
+ const vm = getCurrentInstance ()
16
22
const router = useRouter ()
17
23
const scrollOnClick = computed (() => props .to && ! (props .target === ' _blank' || props .external ))
18
24
25
+ function focus() {
26
+ setTimeout (() => {
27
+ if (props .button )
28
+ vm ?.vnode .el ?.querySelector (' button' )?.focus ()
29
+ else
30
+ vm ?.vnode .el ?.focus ()
31
+ }, 100 )
32
+ }
33
+
34
+ defineExpose ({ focus })
35
+
19
36
useCommand ({
20
37
scope: ' Settings' ,
21
38
@@ -45,13 +62,17 @@ useCommand({
45
62
exact-active-class =" text-primary"
46
63
:class =" disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
47
64
block w-full group focus:outline-none
48
- :tabindex =" disabled ? -1 : null"
65
+ :tabindex =" !button && disabled ? -1 : undefined"
66
+ :custom =" button"
49
67
@click =" scrollOnClick ? $scrollToTop() : undefined"
50
68
>
51
- <div
69
+ <component
70
+ :is =" button ? 'button' : 'div'"
52
71
w-full flex px5 py3 md:gap2 gap4 items-center
53
72
transition-250 group-hover:bg-active
54
73
group-focus-visible:ring =" 2 current"
74
+ :disabled =" button ? disabled : undefined"
75
+ @click =" button && !disabled && $emit('click')"
55
76
>
56
77
<div flex-1 flex items-center md:gap2 gap4 >
57
78
<div
@@ -85,6 +106,6 @@ useCommand({
85
106
</slot >
86
107
</p >
87
108
<div v-if =" to" :class =" !external ? 'i-ri:arrow-right-s-line' : 'i-ri:external-link-line'" text-xl text-secondary-light class =" rtl-flip" />
88
- </div >
109
+ </component >
89
110
</NuxtLink >
90
111
</template >
Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ useHydratedHead({
6
6
title : () => ` ${t (' settings.about.label' )} | ${t (' nav.settings' )} ` ,
7
7
})
8
8
9
+ const commitRef = ref ()
9
10
const showCommit = ref (buildInfo .env !== ' release' && buildInfo .env !== ' dev' )
10
11
const builtTime = useFormattedDateTime (buildInfo .time )
11
12
12
13
function handleShowCommit() {
13
14
setTimeout (() => {
14
15
showCommit .value = true
16
+ nextTick (() => commitRef .value ?.focus ())
15
17
}, 50 )
16
18
}
17
19
</script >
@@ -33,9 +35,12 @@ function handleShowCommit() {
33
35
34
36
<template v-if =" isHydrated " >
35
37
<SettingsItem
38
+ ref =" commitRef"
36
39
:text =" $t('settings.about.version')"
37
40
:to =" showCommit ? `https://github.com/elk-zone/elk/commit/${buildInfo.commit}` : undefined"
38
- external target =" _blank"
41
+ external
42
+ target =" _blank"
43
+ :button =" !showCommit"
39
44
@click =" handleShowCommit"
40
45
>
41
46
<template #content >
@@ -54,7 +59,9 @@ function handleShowCommit() {
54
59
<SettingsItem
55
60
:text =" $t('nav.show_intro')"
56
61
icon =" i-ri:article-line"
57
- cursor-pointer large
62
+ cursor-pointer
63
+ large
64
+ button
58
65
@click =" openPreviewHelp"
59
66
/>
60
67
You can’t perform that action at this time.
0 commit comments