Skip to content

Commit

Permalink
Merge pull request #158 from bcgov/feature/accessibility
Browse files Browse the repository at this point in the history
Accessibility updates
  • Loading branch information
kyle1morel authored Sep 12, 2024
2 parents 30cac1a + 05ea57c commit 85e1b89
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 2 deletions.
2 changes: 2 additions & 0 deletions frontend/src/components/form/AutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<template>
<div class="field">
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -53,6 +54,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<AutoComplete
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
class="w-full"
:class="{ 'p-invalid': errorMessage }"
:delay="delay"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const { errorMessage, value } = useField<Date>(toRef(props, 'name'));
<template>
<div class="field">
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -41,6 +42,7 @@ const { errorMessage, value } = useField<Date>(toRef(props, 'name'));
<Calendar
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
class="w-full"
:class="{ 'p-invalid': errorMessage }"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
v-model="value"
binary
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:class="{ 'p-invalid': errorMessage || invalid }"
:disabled="disabled"
/>
<label
:id="`${name}-label`"
class="pl-2 mb-0"
:class="{ 'font-bold': bold }"
:for="name"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/EditableDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<template>
<div class="field">
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -46,6 +47,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
v-model="value"
editable
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:placeholder="placeholder"
class="w-full"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/InputNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const { errorMessage, value } = useField<number>(toRef(props, 'name'));
<template>
<div class="field">
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -38,6 +39,7 @@ const { errorMessage, value } = useField<number>(toRef(props, 'name'));
<InputNumber
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:placeholder="placeholder"
class="w-full"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/Password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<template>
<div class="field">
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="props.name"
>
Expand All @@ -35,6 +36,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<Password
v-model="value"
:aria-describedby="`${props.name}-help`"
:aria-labelledby="`${name}-label`"
:name="props.name"
:type="props.type"
:placeholder="props.placeholder"
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/form/RadioList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ watch(value, () => {
<div>
<RadioButton
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-option-${option}`"
:input-id="option"
:name="name"
:value="option"
Expand All @@ -54,6 +56,7 @@ watch(value, () => {
@click="emit('onClick', value)"
/>
<span
:id="`${name}-option-${option}`"
:for="option"
class="ml-2 mb-0"
>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/StepperNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function handlePrevClick() {
<template>
<div class="flex pt-4 justify-content-between">
<Button
aria-label="Go to previous page"
:class="props.prevDisabled ? 'button-hidden' : 'button-visible'"
class="px-4 py-1"
outlined
Expand All @@ -49,6 +50,7 @@ function handlePrevClick() {
/>
<slot name="content" />
<Button
aria-label="Go to next page"
:class="props.nextDisabled ? 'button-hidden' : 'button-visible'"
class="px-4 py-1"
outlined
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/TextArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<template>
<div class="field">
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -39,6 +40,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<Textarea
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:placeholder="placeholder"
class="w-full"
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/form/internal/DropdownInternal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<!-- Label needs to be set differently depending if it's floating or not -->
<label
v-if="!props.floatLabel"
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -52,6 +53,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<Dropdown
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:placeholder="placeholder"
class="w-full"
Expand All @@ -65,6 +67,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
/>
<label
v-if="props.floatLabel"
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/internal/InputMaskInternal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));

<template>
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -31,6 +32,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<InputMask
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:mask="mask"
:placeholder="placeholder"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/form/internal/InputTextInternal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));

<template>
<label
:id="`${name}-label`"
:class="{ 'font-bold': bold }"
:for="name"
>
Expand All @@ -34,6 +35,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
<InputText
v-model="value"
:aria-describedby="`${name}-help`"
:aria-labelledby="`${name}-label`"
:name="name"
:placeholder="placeholder"
class="w-full"
Expand Down
26 changes: 24 additions & 2 deletions frontend/src/components/layout/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,43 @@ onMounted(() => {
custom
>
<a
:aria-labelledby="item.label as string"
:href="href"
v-bind="props.action"
@click="navigate"
>
<span class="flex">{{ item.label }}</span>
<span
:id="item.label as string"
class="flex"
>
{{ item.label }}
</span>
</a>
</router-link>
<a
v-else-if="item.mailTo"
:aria-labelledby="item.label as string"
:href="item.mailTo"
class="mail-link"
>
<span class="flex">{{ item.label }}</span>
<span
:id="item.label as string"
class="flex"
>
{{ item.label }}
</span>
</a>
<a
v-else
:aria-labelledby="item.label as string"
:href="item.url"
:target="item.target"
v-bind="props.action"
>
<span class="flex">{{ item.label }}</span>
<span
v-if="hasSubmenu"
:id="item.label as string"
class="pi pi-angle-down mt-1 ml-1"
/>
</a>
Expand All @@ -157,6 +171,14 @@ onMounted(() => {
border: none;
padding: 0;
:deep(.p-menuitem) {
&.p-focus {
> .p-menuitem-content {
background-color: #5a7da9;
}
}
}
:deep(.p-menuitem-content) {
background-color: #38598a;
border-radius: 0;
Expand Down

0 comments on commit 85e1b89

Please sign in to comment.