Skip to content

Commit 19c0e6a

Browse files
committed
fix(css): update hover and focus to make the ui more accessible
1 parent 06e1c7a commit 19c0e6a

17 files changed

+93
-26
lines changed

src/components/common/buttons/ButtonLinkExternal.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const anchor = ref();
4343
>
4444
<span>{{ label }}</span>
4545
<template #trigger>
46-
<a ref="anchor" class="anchor-link" :href="href" :title="title">
46+
<a ref="anchor" class="anchor-link" :href="href" :title="title" tabindex="-1">
4747
<NButton
4848
tertiary
4949
class="external-link"
@@ -71,6 +71,11 @@ const anchor = ref();
7171
.external-link {
7272
height: unset;
7373
min-height: var(--n-height);
74+
border: 1px solid transparent;
75+
76+
&:focus-visible {
77+
border: var(--n-border-focus);
78+
}
7479
}
7580
7681
.external-link:not(.slotted) {

src/components/common/buttons/TagLink.vue

+16-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const onClick = (e: MouseEvent) => {
2727

2828
<template>
2929
<a
30+
class="anchor"
3031
:href="tag?.url"
3132
:title="tag?.title ?? tag?.url"
3233
:data-tag="JSON.stringify(tag)"
@@ -47,8 +48,19 @@ const onClick = (e: MouseEvent) => {
4748
</template>
4849

4950
<style lang="scss" scoped>
50-
.tag {
51-
width: fit-content;
51+
.anchor {
52+
outline: none;
53+
54+
.tag {
55+
width: fit-content;
56+
border: 1px solid transparent;
57+
}
58+
59+
&:focus-visible {
60+
.tag {
61+
border: 1px solid var(--n-color-checked);
62+
}
63+
}
5264
}
5365
5466
.link {
@@ -62,6 +74,8 @@ const onClick = (e: MouseEvent) => {
6274
padding-left: 0.15rem;
6375
}
6476
77+
&:active,
78+
&:focus-within,
6579
&:hover {
6680
background-color: color-mix(
6781
in srgb,

src/components/common/buttons/TitleLink.vue

+27-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ const onTitleClick = (e: MouseEvent) => {
2929
</script>
3030

3131
<template>
32-
<a class="anchor-link" :title="label" @click="onTitleClick">
32+
<a
33+
class="anchor-link"
34+
:class="{ 'has-link': !!$attrs.href }"
35+
:title="label"
36+
@click="onTitleClick"
37+
>
3338
<component :is="component" class="content" :class="{ 'hover-link': !!$attrs.href }">
3439
<slot />
3540
</component>
@@ -43,18 +48,32 @@ const onTitleClick = (e: MouseEvent) => {
4348
z-index: layers.$in-front;
4449
color: inherit;
4550
text-decoration: none;
51+
outline: none;
52+
transition: color 0.3s var(--n-bezier);
53+
will-change: color;
4654
47-
.content {
48-
margin: 0;
55+
&:focus-visible:not(.has-link) {
56+
text-decoration: underline;
57+
text-underline-offset: 0.2rem;
4958
}
50-
}
5159
52-
.hover-link {
53-
transition: color 0.3s var(--n-bezier);
54-
will-change: color;
60+
.hover-link {
61+
transition: color 0.3s var(--n-bezier);
62+
will-change: color;
5563
56-
&:hover {
64+
&:active,
65+
&:focus-within,
66+
&:hover {
67+
color: var(--trakt-red);
68+
}
69+
}
70+
71+
&:focus-visible.has-link .hover-link {
5772
color: var(--trakt-red);
5873
}
74+
75+
.content {
76+
margin: 0;
77+
}
5978
}
6079
</style>

src/components/common/typography/TextField.vue

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ const { openTab } = useLinksStore();
163163
}
164164
}
165165
166+
&:active .prefix,
167+
&:focus-within .prefix,
166168
&:hover .prefix {
167169
color: var(--white-70);
168170
}

src/components/container/ContainerComponent.ce.vue

+2
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ onBeforeMount(() => addCustomProgressProperty());
239239
-webkit-backdrop-filter: blur(var(--bg-blur));
240240
backdrop-filter: blur(var(--bg-blur));
241241
242+
&:active,
243+
&:focus-within,
242244
&:hover {
243245
background: var(--custom-bg-color-hover, var(--bg-black-90));
244246
// stylelint-disable-next-line property-no-vendor-prefix -- necessary for safari

src/components/views/checkin/CheckinComponent.vue

+2
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ const onClick = () => {
293293
&.watching {
294294
height: 1.75rem;
295295
296+
&:active,
297+
&:focus-within,
296298
&:hover {
297299
height: 3rem;
298300
color: var(--white);

src/components/views/login/LoginCard.vue

+2
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ onMounted(() => {
218218
}
219219
}
220220
221+
&:active,
222+
&:focus-within,
221223
&:hover {
222224
.title:not(&.progress) {
223225
--color: rgb(99 226 184 / 9%);

src/components/views/panel/PanelButtonProgress.vue

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ const percentageLabel = computed(() => {
102102
filter 0.3s var(--n-bezier),
103103
--progress 0.3s var(--n-bezier);
104104
105+
&:active,
106+
&:focus-within,
105107
&:hover {
106108
filter: brightness(1.2);
107109
}

src/components/views/panel/PanelOverview.vue

-15
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,6 @@ const { openTab } = useLinksStore();
4848
<style lang="scss" scoped>
4949
@use '~/styles/z-index' as layers;
5050
51-
.anchor-link {
52-
z-index: layers.$in-front;
53-
color: inherit;
54-
text-decoration: none;
55-
}
56-
57-
.hover-link {
58-
transition: color 0.3s var(--n-bezier);
59-
will-change: color;
60-
61-
&:hover {
62-
color: var(--trakt-red);
63-
}
64-
}
65-
6651
.overview {
6752
width: 100%;
6853

src/components/views/panel/PanelRating.vue

+10
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ const _rating = computed(() => (rating?.value ?? 0) * 10);
128128
margin-top: 0.5rem;
129129
}
130130
131+
:deep(.anchor-link .external-link) {
132+
padding: 0;
133+
border-width: 2px;
134+
border-radius: 50%;
135+
136+
&:focus-visible {
137+
border-width: 2px;
138+
}
139+
}
140+
131141
@media (width <= 725px) {
132142
padding: 0.5rem 10%;
133143
}

src/components/views/panel/PanelSelectProgress.vue

+2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ const renderLabel = (option: SelectOption & { icon: Component }) => [
199199
filter 0.3s var(--n-bezier),
200200
--progress 0.3s var(--n-bezier);
201201
202+
&:active,
203+
&:focus-within,
202204
&:hover {
203205
filter: brightness(1.2);
204206
}

src/components/views/panel/ShowPanelPicker.vue

+8
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,16 @@ const i18n = useI18n('panel', 'picker');
155155
font-weight: 600;
156156
text-decoration: none;
157157
transition: color 0.3s var(--n-bezier);
158+
159+
&:focus-visible {
160+
text-decoration: underline;
161+
outline: none;
162+
text-underline-offset: 0.2rem;
163+
}
158164
}
159165
166+
.row:active,
167+
.row:focus-within,
160168
.row:hover {
161169
.prefix {
162170
color: var(--white-70);

src/components/views/settings/SettingsAccount.vue

+4
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ onDeactivated(() => {
362362
margin-bottom: 1.5rem;
363363
background: var(--bg-black-soft);
364364
365+
&:active,
366+
&:focus-within,
365367
&:hover {
366368
--border-color: var(--white-15);
367369
}
@@ -375,6 +377,8 @@ onDeactivated(() => {
375377
border-radius: 50%;
376378
transition: box-shadow 0.5s var(--n-bezier);
377379
380+
&:active,
381+
&:focus-within,
378382
&:hover {
379383
box-shadow: var(--image-box-shadow);
380384
}

src/components/views/settings/SettingsComponent.vue

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ onDeactivated(() => {
107107
:title="i18n(section.title)"
108108
@mouseenter="onEnter(section)"
109109
@mouseleave="onLeave(section)"
110+
@focusin="onEnter(section)"
111+
@focusout="onLeave(section)"
110112
>
111113
<component :is="section.component" />
112114
</NCard>
@@ -135,6 +137,8 @@ onDeactivated(() => {
135137
margin-bottom: 1rem;
136138
}
137139
140+
&:active,
141+
&:focus-within,
138142
&:hover {
139143
z-index: var(--length);
140144
}

src/components/views/settings/SettingsFormItem.vue

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ defineProps({
6969
text-align: start;
7070
}
7171
72+
&:active,
73+
&:focus-within,
7274
&:hover {
7375
.from-label {
7476
color: var(--white-mute);

src/components/views/settings/SettingsLinks.vue

+2
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ const containerRef = ref<HTMLDivElement>();
295295
296296
background: var(--bg-black-soft);
297297
298+
&:active,
299+
&:focus-within,
298300
&:hover {
299301
--border-color: var(--white-15);
300302
}

src/styles/mixin.scss

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
will-change: color, background, background-color, backdrop-filter, box-shadow,
1515
border-color, scale, opacity, backdrop-filter;
1616

17+
&:active,
1718
&:hover {
1819
background: $to;
1920
// stylelint-disable-next-line property-no-vendor-prefix -- necessary for safari
@@ -29,6 +30,7 @@
2930
) {
3031
background: $from;
3132

33+
&:active,
3234
&:hover {
3335
background: $to;
3436
}

0 commit comments

Comments
 (0)