Skip to content

Commit 24feda9

Browse files
committed
Update keyboard focus outline
1 parent a316829 commit 24feda9

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

src/assets/main.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ html {
3030
height: 100%;
3131
width: 100%;
3232
overflow: hidden;
33-
outline: none;
3433
@include borderRadiusOverflowHidden(8px);
3534
}
3635

@@ -51,7 +50,6 @@ body {
5150

5251
button, a {
5352
border: none;
54-
outline: none;
5553
text-decoration: none;
5654
background-color: unset;
5755
color: currentColor;

src/assets/mixins.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@
88
text-shadow: 0 0 $size black, 0 0 $size black, 0 0 $size black, 0 0 $size black;
99
}
1010

11+
@keyframes outline-anim {
12+
0% {
13+
outline-offset: 5px;
14+
}
15+
100% {
16+
outline-offset: 0px;
17+
}
18+
}
19+
1120
@mixin focus-visible($additionalShadow: null) {
1221
outline: none;
1322
&:not([disabled])[data-focus-visible-added] {
14-
box-shadow: 0px 0px 0px 1px var(--white-faded);
23+
outline: auto;
24+
animation: outline-anim .2s forwards;
1525
}
1626
}
1727

src/components/AppButton.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function handleClick(e: MouseEvent) {
5454
font-size: 14px;
5555
padding: 8px 12px;
5656
border: 1px solid var(--item-border-color);
57-
outline: none;
5857
background-color: var(--item-bg);
5958
position: relative;
6059
overflow: hidden;

src/components/AppContent.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1+
<script lang="ts" setup>
2+
import { ref, watch } from 'vue'
3+
import { useStore } from '../stores/store'
4+
import type { Option } from '../types'
5+
6+
const store = useStore()
7+
const mainEl = ref<Option<HTMLElement>>(null)
8+
9+
watch(() => store.currentPage, () => {
10+
mainEl.value?.focus()
11+
}, { flush: 'post' })
12+
</script>
13+
114
<template>
2-
<main class="main">
15+
<main
16+
ref="mainEl"
17+
tabindex="-1"
18+
class="main"
19+
>
320
<slot />
421
</main>
522
</template>
@@ -11,5 +28,6 @@
1128
overflow: hidden;
1229
background-color: var(--content-bg);
1330
position: relative;
31+
outline: none;
1432
}
1533
</style>

src/pages/SettingsPage.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ useKey('esc', handleBack, { prevent: true })
112112

113113
<style lang="scss" scoped>
114114
.settings {
115-
outline: none;
116115
position: absolute;
117116
left: 0;
118117
top: 0;

0 commit comments

Comments
 (0)