Skip to content

Commit 6c541e7

Browse files
committed
fix: remove things handled by modal
1 parent a77f821 commit 6c541e7

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

app/components/AppFooter.vue

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,9 @@
11
<script setup lang="ts">
2-
import { ref, computed } from 'vue'
3-
import { onKeyDown } from '@vueuse/core'
4-
52
const route = useRoute()
63
const isHome = computed(() => route.name === 'index')
74
8-
const triggerRef = useTemplateRef('triggerRef')
95
const modalRef = useTemplateRef('modalRef')
10-
const modalOpen = ref(false)
11-
12-
const togglePopover = (e?: Event) => {
13-
e?.stopPropagation()
14-
if (!modalOpen.value) {
15-
modalRef.value?.showModal?.()
16-
modalOpen.value = true
17-
} else {
18-
modalRef.value?.close?.()
19-
modalOpen.value = false
20-
}
21-
}
22-
23-
onKeyDown(
24-
'Escape',
25-
(e: KeyboardEvent) => {
26-
if (!modalOpen.value) return
27-
e.preventDefault()
28-
e.stopImmediatePropagation()
29-
modalRef.value?.close?.()
30-
modalOpen.value = false
31-
},
32-
{ dedupe: true },
33-
)
34-
35-
function onModalClosed() {
36-
modalOpen.value = false
37-
triggerRef.value?.focus?.()
38-
}
6+
const showModal = () => modalRef.value?.showModal?.()
397
</script>
408

419
<template>
@@ -70,19 +38,16 @@ function onModalClosed() {
7038
</LinkBase>
7139

7240
<button
73-
ref="triggerRef"
7441
type="button"
7542
class="group inline-flex gap-x-1 items-center justify-center underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200"
76-
@click.prevent="togglePopover"
77-
:aria-expanded="modalOpen ? 'true' : 'false'"
43+
@click.prevent="showModal"
7844
aria-haspopup="dialog"
7945
>
8046
{{ $t('footer.keyboard_shortcuts') }}
8147
</button>
8248

8349
<Modal
8450
ref="modalRef"
85-
@close="onModalClosed"
8651
:modalTitle="$t('footer.keyboard_shortcuts')"
8752
class="w-auto max-w-lg"
8853
>

0 commit comments

Comments
 (0)