Skip to content

Commit dc9f536

Browse files
fix: fix clickables accessibility
1 parent c02578b commit dc9f536

File tree

9 files changed

+37
-21
lines changed

9 files changed

+37
-21
lines changed

playground/app.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default defineAppConfig({
22
toaster: {
3-
maxToasts: 10
4-
}
3+
maxToasts: 10,
4+
},
55
})

playground/assets/css/main.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import './modules/accessibility.css';
2+
13
@tailwind base;
24
@tailwind components;
35
@tailwind utilities;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@layer utilities {
2+
.tw-accessibility {
3+
@apply outline-none focus-visible:outline-none focus-visible:outline-dashed focus-visible:outline-muted-300 dark:focus-visible:outline-muted-600 focus-visible:outline-offset-2;
4+
}
5+
6+
.tw-accessibility-static {
7+
@apply outline-dashed outline-muted-300 dark:outline-muted-600 outline-offset-2;
8+
}
9+
}

playground/components/Hero.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
>
6666
<input
6767
type="text"
68-
class="w-full h-14 pl-14 pr-4 py-2 rounded-xl font-mono text-muted-600 dark:text-muted-400 bg-white dark:bg-muted-1000 border border-muted-200 dark:border-muted-800 group-hover:shadow-xl group-hover:shadow-muted-400/10 dark:group-hover:shadow-muted-800/10 transition-all duration-300"
68+
class="w-full h-14 pl-14 pr-4 py-2 rounded-xl font-mono text-muted-600 dark:text-muted-400 bg-white dark:bg-muted-1000 border border-muted-200 dark:border-muted-800 group-hover:shadow-xl group-hover:shadow-muted-400/10 dark:group-hover:shadow-muted-800/10 transition-all duration-300 tw-accessibility"
6969
value="npm i -D @cssninja/nuxt-toaster"
7070
/>
7171
<!-- Terminal icon -->
@@ -82,9 +82,9 @@
8282
<!-- Copy button -->
8383
<button
8484
type="button"
85-
class="w-full lg:w-auto lg:absolute top-2 right-2 h-12 lg:h-10 py-2 px-5 rounded-lg text-sm text-white bg-indigo-500 hover:shadow-xl hover:shadow-indigo-500/20 dark:hover:shadow-indigo-800/10 transition-all duration-300"
85+
class="w-full lg:w-auto lg:absolute top-2 right-2 h-12 lg:h-10 py-2 px-5 rounded-lg text-sm text-white bg-indigo-500 hover:shadow-xl hover:shadow-indigo-500/20 dark:hover:shadow-indigo-800/10 transition-all duration-300 tw-accessibility"
8686
>
87-
Copy
87+
Try Me
8888
</button>
8989
</div>
9090
</div>

playground/components/Navigation.vue

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ const isChecked = ref(false)
2222
<div class="mx-auto w-full max-w-7xl p-4">
2323
<div class="w-full flex items-center justify-between gap-x-2">
2424
<div class="w-full lg:w-auto flex items-center gap-x-2">
25-
<img class="w-9 h-9" src="/assets/img/logo.svg" alt="Logo" />
26-
<img
27-
class="h-5 dark:invert"
28-
src="/assets/img/logo-text.svg"
29-
alt="Logo text"
30-
/>
25+
<NuxtLink to="/" class="flex items-center gap-2 tw-accessibility">
26+
<img class="w-9 h-9" src="/assets/img/logo.svg" alt="Logo" />
27+
<img
28+
class="h-5 dark:invert"
29+
src="/assets/img/logo-text.svg"
30+
alt="Logo text"
31+
/>
32+
</NuxtLink>
3133

3234
<!-- Hamburger -->
3335
<button
34-
class="flex relative justify-center items-center ml-auto w-10 h-10 focus:outline-none lg:hidden"
36+
class="flex relative justify-center items-center ml-auto w-10 h-10 lg:hidden tw-accessibility"
3537
@click="mobileOpen = !mobileOpen"
3638
>
3739
<div
@@ -61,19 +63,19 @@ const isChecked = ref(false)
6163
>
6264
<NuxtLink
6365
to="/"
64-
class="text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300"
66+
class="text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300 tw-accessibility"
6567
>Examples</NuxtLink
6668
>
6769
<NuxtLink
6870
to="/api"
69-
class="text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300"
71+
class="text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300 tw-accessibility"
7072
>API docs</NuxtLink
7173
>
7274
</div>
7375
<div class="flex items-center justify-end gap-x-1 lg:pl-4">
7476
<NuxtLink
7577
to="/"
76-
class="w-10 h-10 flex items-center justify-center rounded-full text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300"
78+
class="w-10 h-10 flex items-center justify-center rounded-full text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300 tw-accessibility"
7779
>
7880
<svg class="w-5 h-5" viewBox="0 0 1536 1504">
7981
<path
@@ -84,7 +86,7 @@ const isChecked = ref(false)
8486
</NuxtLink>
8587
<NuxtLink
8688
to="/"
87-
class="w-10 h-10 flex items-center justify-center rounded-full text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300"
89+
class="w-10 h-10 flex items-center justify-center rounded-full text-muted-700 hover:text-muted-500 dark:text-muted-400 dark:hover:text-muted-200 transition-colors duration-300 tw-accessibility"
8890
>
8991
<svg class="w-5 h-5" viewBox="0 0 1600 1280">
9092
<path
@@ -94,7 +96,9 @@ const isChecked = ref(false)
9496
</svg>
9597
</NuxtLink>
9698
<!-- Theme -->
97-
<label class="block w-9 h-9 overflow-hidden relative mx-auto">
99+
<label
100+
class="block w-9 h-9 rounded-full overflow-hidden relative mx-auto focus-within:tw-accessibility-static"
101+
>
98102
<input
99103
v-model="isChecked"
100104
type="checkbox"

playground/components/toast/ActionButtons.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
>
55
<button
66
type="button"
7-
class="h-10 w-28 py-2 px-4 inline-flex items-center justify-center rounded-xl text-sm text-muted-500 bg-muted-100 dark:bg-muted-900 hover:text-muted-600 dark:text-muted-400 hover:bg-muted-50 dark:hover:bg-muted-1000 dark:hover:text-muted-100 transition-colors duration-300"
7+
class="h-10 w-28 py-2 px-4 inline-flex items-center justify-center rounded-xl text-sm text-muted-500 bg-muted-100 dark:bg-muted-900 hover:text-muted-600 dark:text-muted-400 hover:bg-muted-50 dark:hover:bg-muted-1000 dark:hover:text-muted-100 transition-colors duration-300 tw-accessibility"
88
>
99
Dismiss
1010
</button>
1111
<button
1212
type="button"
13-
class="h-10 w-28 py-2 px-4 inline-flex items-center justify-center rounded-xl text-sm text-sky-500 dark:text-muted-100 bg-sky-100 dark:bg-sky-500 hover:text-sky-600 dark:hover:text-white hover:bg-sky-50 dark:hover:bg-sky-600 transition-colors duration-300"
13+
class="h-10 w-28 py-2 px-4 inline-flex items-center justify-center rounded-xl text-sm text-sky-500 dark:text-muted-100 bg-sky-100 dark:bg-sky-500 hover:text-sky-600 dark:hover:text-white hover:bg-sky-50 dark:hover:bg-sky-600 transition-colors duration-300 tw-accessibility"
1414
>
1515
Accept
1616
</button>

playground/components/toast/IconSoloDanger.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</div>
2727
<button
2828
type="button"
29-
class="h-11 w-11 flex items-center justify-center ml-auto text-muted-700 dark:text-muted-400"
29+
class="h-9 w-9 flex items-center justify-center rounded-full ml-auto text-muted-700 dark:text-muted-400 hover:bg-muted-100 dark:hover:bg-muted-700 transition-colors duration-300 tw-accessibility"
3030
>
3131
<svg class="w-4 h-4" viewBox="0 0 24 24">
3232
<path

playground/components/toast/UserReplyClose.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
<button
2222
type="button"
23-
class="h-11 w-11 flex items-center justify-center ml-auto text-muted-400"
23+
class="h-9 w-9 flex items-center justify-center rounded-full ml-auto text-muted-700 dark:text-muted-400 hover:bg-muted-100 dark:hover:bg-muted-700 transition-colors duration-300 tw-accessibility"
2424
>
2525
<svg class="w-4 h-4" viewBox="0 0 24 24">
2626
<path

playground/nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import NinjaNuxtToaster from '..'
33

44
export default defineNuxtConfig({
55
modules: ['@nuxtjs/tailwindcss', NinjaNuxtToaster],
6+
css: ['@/assets/css/main.css'],
67
app: {
78
head: {
89
link: [

0 commit comments

Comments
 (0)