Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 9a7c524

Browse files
Add ARIA labels to settings page - Vue (#397)
* associate profile image label with input * aria-label <main> with settings region-id * apply aria to label profile setting form * label empty button --------- Co-authored-by: Rizel Scarlett <[email protected]>
1 parent 0cf3b51 commit 9a7c524

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

javascript/dwa-starter-vue/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Sidebar from '@/components/Sidebar.vue'
99
<Sidebar />
1010
</header>
1111

12-
<main class="p-4 lg:h-screen overflow-y-auto flex flex-col w-full">
12+
<main class="p-4 lg:h-screen overflow-y-auto flex flex-col w-full" aria-labelledby="region-id">
1313
<RouterView />
1414
</main>
1515
</div>

javascript/dwa-starter-vue/src/views/SettingsView.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ const onSubmit = handleSubmit(async (values) => {
8989

9090
<template>
9191
<div class="flex flex-col gap-4">
92-
<h1>Settings</h1>
92+
<h1 id="region-id">Settings</h1>
9393

94-
<h2>Profile Settings</h2>
95-
<form class="lg:w-1/3 w-full space-y-6" @submit.prevent="onSubmit">
94+
<h2 id="profile-form-id">Profile Settings</h2>
95+
<form class="lg:w-1/3 w-full space-y-6" aria-labelledby="profile-form-id" @submit.prevent="onSubmit">
9696
<img
9797
v-if="profileImageSrc"
9898
:src="profileImageSrc"
@@ -104,8 +104,8 @@ const onSubmit = handleSubmit(async (values) => {
104104
<FormField name="profileImage" class="w-full">
105105
<FormItem>
106106
<FormLabel>Profile Image</FormLabel>
107-
<FormControl>
108-
<div class="flex items-center gap-2">
107+
<div class="flex items-center gap-2">
108+
<FormControl>
109109
<Input
110110
type="file"
111111
accept="image/*"
@@ -114,8 +114,8 @@ const onSubmit = handleSubmit(async (values) => {
114114
:key="fileInputKey"
115115
/>
116116
<Button type="button" @click="clearImage" v-if="profileImageSrc">Clear Image</Button>
117-
</div>
118-
</FormControl>
117+
</FormControl>
118+
</div>
119119
<FormDescription>Upload your profile image.</FormDescription>
120120
<FormMessage />
121121
</FormItem>
@@ -133,7 +133,8 @@ const onSubmit = handleSubmit(async (values) => {
133133
</FormField>
134134

135135
<Button type="submit" :disabled="isSubmitting">
136-
<ReloadIcon v-if="isSubmitting" class="w-4 h-4 mr-2 animate-spin" />
136+
<ReloadIcon v-if="isSubmitting" class="w-4 h-4 mr-2 animate-spin" />
137+
<span v-if="isSubmitting" class="sr-only">Submitting your changes</span>
137138
<span v-else>Save</span>
138139
</Button>
139140
</form>

0 commit comments

Comments
 (0)