Commit c142b57c authored by Coung Ngo's avatar Coung Ngo

Add aria labels to icon-only buttons

Add aria labels to icon-only buttons to provide
accessible names for screen readers
parent a3c410dc
...@@ -51,8 +51,18 @@ export default { ...@@ -51,8 +51,18 @@ export default {
<template> <template>
<gl-button-group class="gl-z-index-1"> <gl-button-group class="gl-z-index-1">
<gl-button icon="dash" :disabled="disableDecrease" @click="decrementScale" /> <gl-button
<gl-button icon="redo" :disabled="disableReset" @click="resetScale" /> icon="dash"
<gl-button icon="plus" :disabled="disableIncrease" @click="incrementScale" /> :disabled="disableDecrease"
:aria-label="__('Decrease')"
@click="decrementScale"
/>
<gl-button icon="redo" :disabled="disableReset" :aria-label="__('Reset')" @click="resetScale" />
<gl-button
icon="plus"
:disabled="disableIncrease"
:aria-label="__('Increase')"
@click="incrementScale"
/>
</gl-button-group> </gl-button-group>
</template> </template>
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
GlTooltipDirective, GlTooltipDirective,
GlModalDirective, GlModalDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
import timeagoMixin from '~/vue_shared/mixins/timeago'; import timeagoMixin from '~/vue_shared/mixins/timeago';
export default { export default {
...@@ -24,11 +24,12 @@ export default { ...@@ -24,11 +24,12 @@ export default {
createdTimeagoLabel: s__('UserList|created %{timeago}'), createdTimeagoLabel: s__('UserList|created %{timeago}'),
deleteListTitle: s__('UserList|Delete %{name}?'), deleteListTitle: s__('UserList|Delete %{name}?'),
deleteListMessage: s__('User list %{name} will be removed. Are you sure?'), deleteListMessage: s__('User list %{name} will be removed. Are you sure?'),
editUserListLabel: s__('FeatureFlags|Edit User List'),
}, },
modal: { modal: {
id: 'deleteListModal', id: 'deleteListModal',
actionPrimary: { actionPrimary: {
text: s__('Delete user list'), text: __('Delete user list'),
attributes: { variant: 'danger', 'data-testid': 'modal-confirm' }, attributes: { variant: 'danger', 'data-testid': 'modal-confirm' },
}, },
}, },
...@@ -93,6 +94,7 @@ export default { ...@@ -93,6 +94,7 @@ export default {
:href="list.path" :href="list.path"
category="secondary" category="secondary"
icon="pencil" icon="pencil"
:aria-label="$options.translations.editUserListLabel"
data-testid="edit-user-list" data-testid="edit-user-list"
/> />
<gl-button <gl-button
......
...@@ -13,6 +13,12 @@ import { splitCamelCase } from '../../lib/utils/text_utility'; ...@@ -13,6 +13,12 @@ import { splitCamelCase } from '../../lib/utils/text_utility';
import ReplyButton from './note_actions/reply_button.vue'; import ReplyButton from './note_actions/reply_button.vue';
export default { export default {
i18n: {
addReactionLabel: __('Add reaction'),
editCommentLabel: __('Edit comment'),
deleteCommentLabel: __('Delete comment'),
moreActionsLabel: __('More actions'),
},
name: 'NoteActions', name: 'NoteActions',
components: { components: {
GlIcon, GlIcon,
...@@ -301,9 +307,9 @@ export default { ...@@ -301,9 +307,9 @@ export default {
category="tertiary" category="tertiary"
variant="default" variant="default"
size="small" size="small"
title="Add reaction" :title="$options.i18n.addReactionLabel"
:aria-label="$options.i18n.addReactionLabel"
data-position="right" data-position="right"
:aria-label="__('Add reaction')"
> >
<span class="reaction-control-icon reaction-control-icon-neutral"> <span class="reaction-control-icon reaction-control-icon-neutral">
<gl-icon name="slight-smile" /> <gl-icon name="slight-smile" />
...@@ -325,7 +331,8 @@ export default { ...@@ -325,7 +331,8 @@ export default {
<gl-button <gl-button
v-if="canEdit" v-if="canEdit"
v-gl-tooltip v-gl-tooltip
title="Edit comment" :title="$options.i18n.editCommentLabel"
:aria-label="$options.i18n.editCommentLabel"
icon="pencil" icon="pencil"
size="small" size="small"
category="tertiary" category="tertiary"
...@@ -336,7 +343,8 @@ export default { ...@@ -336,7 +343,8 @@ export default {
<gl-button <gl-button
v-if="showDeleteAction" v-if="showDeleteAction"
v-gl-tooltip v-gl-tooltip
title="Delete comment" :title="$options.i18n.deleteCommentLabel"
:aria-label="$options.i18n.deleteCommentLabel"
size="small" size="small"
icon="remove" icon="remove"
category="tertiary" category="tertiary"
...@@ -346,7 +354,8 @@ export default { ...@@ -346,7 +354,8 @@ export default {
<div v-else-if="shouldShowActionsDropdown" class="dropdown more-actions"> <div v-else-if="shouldShowActionsDropdown" class="dropdown more-actions">
<gl-button <gl-button
v-gl-tooltip v-gl-tooltip
title="More actions" :title="$options.i18n.moreActionsLabel"
:aria-label="$options.i18n.moreActionsLabel"
icon="ellipsis_v" icon="ellipsis_v"
size="small" size="small"
category="tertiary" category="tertiary"
......
...@@ -33,6 +33,7 @@ const i18n = { ...@@ -33,6 +33,7 @@ const i18n = {
submitErrorTitle: s__('Pipeline|Pipeline cannot be run.'), submitErrorTitle: s__('Pipeline|Pipeline cannot be run.'),
warningTitle: __('The form contains the following warning:'), warningTitle: __('The form contains the following warning:'),
maxWarningsSummary: __('%{total} warnings found: showing first %{warningsDisplayed}'), maxWarningsSummary: __('%{total} warnings found: showing first %{warningsDisplayed}'),
removeVariableLabel: s__('CiVariables|Remove variable'),
}; };
export default { export default {
...@@ -416,15 +417,17 @@ export default { ...@@ -416,15 +417,17 @@ export default {
data-testid="remove-ci-variable-row" data-testid="remove-ci-variable-row"
variant="danger" variant="danger"
category="secondary" category="secondary"
:aria-label="$options.i18n.removeVariableLabel"
@click="removeVariable(index)" @click="removeVariable(index)"
> >
<gl-icon class="gl-mr-0! gl-display-none gl-md-display-block" name="clear" /> <gl-icon class="gl-mr-0! gl-display-none gl-md-display-block" name="clear" />
<span class="gl-md-display-none">{{ s__('CiVariables|Remove variable') }}</span> <span class="gl-md-display-none">{{ $options.i18n.removeVariableLabel }}</span>
</gl-button> </gl-button>
<gl-button <gl-button
v-else v-else
class="gl-md-ml-3 gl-mb-3 gl-display-none gl-md-display-block gl-visibility-hidden" class="gl-md-ml-3 gl-mb-3 gl-display-none gl-md-display-block gl-visibility-hidden"
icon="clear" icon="clear"
:aria-label="$options.i18n.removeVariableLabel"
/> />
</template> </template>
</div> </div>
......
...@@ -183,6 +183,7 @@ export default { ...@@ -183,6 +183,7 @@ export default {
class="gl-absolute gl-top-0 gl-bottom-0 gl-shadow-none! gl-rounded-0!" class="gl-absolute gl-top-0 gl-bottom-0 gl-shadow-none! gl-rounded-0!"
:class="`js-pipeline-expand-${pipeline.id} ${expandButtonPosition}`" :class="`js-pipeline-expand-${pipeline.id} ${expandButtonPosition}`"
:icon="expandedIcon" :icon="expandedIcon"
:aria-label="__('Expand pipeline')"
data-testid="expand-pipeline-button" data-testid="expand-pipeline-button"
data-qa-selector="expand_pipeline_button" data-qa-selector="expand_pipeline_button"
@click="onClickLinkedPipeline" @click="onClickLinkedPipeline"
......
...@@ -72,6 +72,7 @@ export default { ...@@ -72,6 +72,7 @@ export default {
size="small" size="small"
class="gl-mr-3 js-back-button" class="gl-mr-3 js-back-button"
icon="angle-left" icon="angle-left"
:aria-label="__('Go back')"
@click="onBackClick" @click="onBackClick"
/> />
......
...@@ -126,6 +126,7 @@ export default { ...@@ -126,6 +126,7 @@ export default {
category="secondary" category="secondary"
variant="danger" variant="danger"
icon="remove" icon="remove"
:aria-label="__('Remove user')"
data-testid="delete-user-id" data-testid="delete-user-id"
@click="removeUserId(id)" @click="removeUserId(id)"
/> />
......
---
title: Add aria labels to icon-only buttons
merge_request: 58459
author:
type: fixed
...@@ -9995,6 +9995,9 @@ msgstr "" ...@@ -9995,6 +9995,9 @@ msgstr ""
msgid "Decompressed archive size validation failed." msgid "Decompressed archive size validation failed."
msgstr "" msgstr ""
msgid "Decrease"
msgstr ""
msgid "Default CI configuration path" msgid "Default CI configuration path"
msgstr "" msgstr ""
...@@ -12618,6 +12621,9 @@ msgstr "" ...@@ -12618,6 +12621,9 @@ msgstr ""
msgid "Expand panel" msgid "Expand panel"
msgstr "" msgstr ""
msgid "Expand pipeline"
msgstr ""
msgid "Expand sidebar" msgid "Expand sidebar"
msgstr "" msgstr ""
...@@ -16560,6 +16566,9 @@ msgstr "" ...@@ -16560,6 +16566,9 @@ msgstr ""
msgid "Incomplete" msgid "Incomplete"
msgstr "" msgstr ""
msgid "Increase"
msgstr ""
msgid "Indent" msgid "Indent"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment