-
Notifications
You must be signed in to change notification settings - Fork 432
Improve accessibility for screen readers #5774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
209711f
dcd4afa
a755203
335a17c
6f4ff3a
6052448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ | |
--> | ||
|
||
<template> | ||
<div class="breadcrumbs"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change the div to a nav element for semantic correctness, as it contains navigation links. |
||
<ul role="navigation"> | ||
<nav aria-label="Breadcrumb" class="breadcrumbs"> | ||
<ul> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure to include an aria-label for accessibility purposes. |
||
<li v-for="breadcrumb in filteredBreadcrumbs" :key="breadcrumb.name"> | ||
<nuxt-link | ||
class="breadcrumbs__item" | ||
|
@@ -29,11 +29,12 @@ | |
v-else | ||
class="breadcrumbs__item --action" | ||
@click="onBreadcrumbAction(breadcrumb)" | ||
:aria-current="breadcrumb.name" | ||
>{{ breadcrumb.name }}</span | ||
> | ||
</li> | ||
</ul> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider providing a more descriptive comment about this component's functionality. |
||
</div> | ||
</nav> | ||
</template> | ||
|
||
<script> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,19 +23,32 @@ | |
<label v-if="$slots.default" :for="id || name" class="switch-label"> | ||
<slot /> | ||
</label> | ||
<div class="switch-container" @click="toggle($event)"> | ||
<div | ||
class="switch-container" | ||
type="button" | ||
role="switch" | ||
@click="toggle($event)" | ||
:aria-label="`${name} ${checked ? 'on' : 'off'}`" | ||
:aria-checked="checked ? 'true' : 'false'" | ||
> | ||
<div class="switch-thumb" :style="styles"> | ||
<input | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider changing the input element's tabindex to '0' for better accessibility. |
||
:id="id" | ||
:id="id || name" | ||
type="checkbox" | ||
:name="name" | ||
:disabled="disabled" | ||
:value="value" | ||
tabindex="-1" | ||
/> | ||
<button :type="type" class="switch-holder"> | ||
<svgicon width="10" height="10" name="check" color="white"></svgicon> | ||
</button> | ||
<div class="switch-holder"> | ||
<svgicon | ||
width="10" | ||
height="10" | ||
name="check" | ||
color="white" | ||
aria-hidden="true" | ||
></svgicon> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
@@ -172,6 +185,9 @@ $switch-thumb-size: 18px; | |
@include absoluteCenter; | ||
width: $switch-thumb-size; | ||
height: $switch-thumb-size; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 0; | ||
padding: 0; | ||
z-index: 2; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<template> | ||
<iframe | ||
:srcdoc="template" | ||
title="sandbox" | ||
ref="iframe" | ||
frameborder="0" | ||
scrolling="no" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
<QuestionsComponent | ||
:questions="record.questions" | ||
:autofocusPosition="autofocusPosition" | ||
:visible-shortcuts="!$platform.isMobile" | ||
:is-bulk-mode="isBulkMode" | ||
@on-focus="updateQuestionAutofocus" | ||
/> | ||
|
@@ -29,7 +30,7 @@ | |
@on-click="onDiscard" | ||
> | ||
<span | ||
v-if="!isDiscarding" | ||
v-if="!isDiscarding && !$platform.isMobile" | ||
class="button__shortcuts" | ||
v-text="'⌫'" | ||
/><span v-text="$t('questions_form.discard')" /> | ||
|
@@ -44,7 +45,7 @@ | |
:data-title="!isSaving ? draftSavingTooltip : null" | ||
@on-click="onSaveDraft" | ||
> | ||
<span v-if="!isDraftSaving" | ||
<span v-if="!isDraftSaving && !$platform.isMobile" | ||
><span | ||
class="button__shortcuts" | ||
v-text="$platform.isMac ? '⌘' : 'ctrl'" /><span | ||
|
@@ -79,7 +80,11 @@ | |
" | ||
@on-click="onSubmit" | ||
> | ||
<span v-if="!isSubmitting" class="button__shortcuts" v-text="'↵'" /> | ||
<span | ||
v-if="!isSubmitting && !$platform.isMobile" | ||
class="button__shortcuts" | ||
v-text="'↵'" | ||
/> | ||
<span v-text="$t('questions_form.submit')" /> | ||
</BaseButton> | ||
</div> | ||
|
@@ -179,7 +184,11 @@ export default { | |
return "--focused-form"; | ||
}, | ||
formHasFocus() { | ||
return this.autofocusPosition || this.autofocusPosition == 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider simplifying this conditional logic to reduce nesting. An early return could enhance readability. |
||
if (!this.$platform.isMobile) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nested if condition can be simplified to improve readability. Consider using an early return pattern. |
||
return this.autofocusPosition || this.autofocusPosition == 0; | ||
} else { | ||
return false; | ||
} | ||
}, | ||
numberOfQuestions() { | ||
return this.record.questions.length; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a period at the end of comments if they form complete sentences.