Commit b1b080ba authored by Coung Ngo's avatar Coung Ngo

Add aria labels to icon buttons

This commit adds aria labels to icon buttons to
give them accessible names
parent 8bb13575
...@@ -21,6 +21,8 @@ import { ...@@ -21,6 +21,8 @@ import {
import getCurrentIntegrationQuery from '../graphql/queries/get_current_integration.query.graphql'; import getCurrentIntegrationQuery from '../graphql/queries/get_current_integration.query.graphql';
export const i18n = { export const i18n = {
deleteIntegration: s__('AlertSettings|Delete integration'),
editIntegration: s__('AlertSettings|Edit integration'),
title: s__('AlertsIntegrations|Current integrations'), title: s__('AlertsIntegrations|Current integrations'),
emptyState: s__('AlertsIntegrations|No integrations have been added yet'), emptyState: s__('AlertsIntegrations|No integrations have been added yet'),
status: { status: {
...@@ -174,11 +176,16 @@ export default { ...@@ -174,11 +176,16 @@ export default {
<template #cell(actions)="{ item }"> <template #cell(actions)="{ item }">
<gl-button-group class="gl-ml-3"> <gl-button-group class="gl-ml-3">
<gl-button icon="settings" @click="editIntegration(item)" /> <gl-button
icon="settings"
:aria-label="$options.i18n.editIntegration"
@click="editIntegration(item)"
/>
<gl-button <gl-button
v-gl-modal.deleteIntegration v-gl-modal.deleteIntegration
:disabled="item.type === $options.typeSet.prometheus" :disabled="item.type === $options.typeSet.prometheus"
icon="remove" icon="remove"
:aria-label="$options.i18n.deleteIntegration"
@click="setIntegrationToDelete(item)" @click="setIntegrationToDelete(item)"
/> />
</gl-button-group> </gl-button-group>
...@@ -198,8 +205,8 @@ export default { ...@@ -198,8 +205,8 @@ export default {
</gl-table> </gl-table>
<gl-modal <gl-modal
modal-id="deleteIntegration" modal-id="deleteIntegration"
:title="s__('AlertSettings|Delete integration')" :title="$options.i18n.deleteIntegration"
:ok-title="s__('AlertSettings|Delete integration')" :ok-title="$options.i18n.deleteIntegration"
ok-variant="danger" ok-variant="danger"
@ok="deleteIntegration" @ok="deleteIntegration"
> >
......
<script> <script>
import { GlLoadingIcon, GlTooltipDirective, GlIcon, GlButton } from '@gitlab/ui'; import { GlLoadingIcon, GlTooltipDirective, GlIcon, GlButton } from '@gitlab/ui';
import { s__ } from '~/locale';
export default { export default {
i18n: {
buttonLabel: s__('Badges|Reload badge image'),
},
// name: 'Badge' is a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/25 // name: 'Badge' is a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/25
// eslint-disable-next-line @gitlab/require-i18n-strings // eslint-disable-next-line @gitlab/require-i18n-strings
name: 'Badge', name: 'Badge',
...@@ -94,7 +98,8 @@ export default { ...@@ -94,7 +98,8 @@ export default {
<gl-button <gl-button
v-show="hasError" v-show="hasError"
v-gl-tooltip.hover v-gl-tooltip.hover
:title="s__('Badges|Reload badge image')" :title="$options.i18n.buttonLabel"
:aria-label="$options.i18n.buttonLabel"
category="tertiary" category="tertiary"
variant="confirm" variant="confirm"
type="button" type="button"
......
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
class="js-focus-mode-btn" class="js-focus-mode-btn"
data-qa-selector="focus_mode_button" data-qa-selector="focus_mode_button"
:title="$options.i18n.toggleFocusMode" :title="$options.i18n.toggleFocusMode"
:aria-label="$options.i18n.toggleFocusMode"
@click="toggleFocusMode" @click="toggleFocusMode"
/> />
</div> </div>
......
...@@ -7,6 +7,10 @@ import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue'; ...@@ -7,6 +7,10 @@ import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
export default { export default {
i18n: {
editButton: s__('Pipelines|Edit'),
revokeButton: s__('Pipelines|Revoke'),
},
components: { components: {
GlTable, GlTable,
GlButton, GlButton,
...@@ -108,13 +112,15 @@ export default { ...@@ -108,13 +112,15 @@ export default {
</template> </template>
<template #cell(actions)="{ item }"> <template #cell(actions)="{ item }">
<gl-button <gl-button
:title="s__('Pipelines|Edit')" :title="$options.i18n.editButton"
:aria-label="$options.i18n.editButton"
icon="pencil" icon="pencil"
data-testid="edit-btn" data-testid="edit-btn"
:href="item.editProjectTriggerPath" :href="item.editProjectTriggerPath"
/> />
<gl-button <gl-button
:title="s__('Pipelines|Revoke')" :title="$options.i18n.revokeButton"
:aria-label="$options.i18n.revokeButton"
icon="remove" icon="remove"
variant="warning" variant="warning"
:data-confirm=" :data-confirm="
......
...@@ -12,6 +12,10 @@ import allDesignsMixin from '../../mixins/all_designs'; ...@@ -12,6 +12,10 @@ import allDesignsMixin from '../../mixins/all_designs';
import { DESIGN_ROUTE_NAME } from '../../router/constants'; import { DESIGN_ROUTE_NAME } from '../../router/constants';
export default { export default {
i18n: {
nextButton: s__('DesignManagement|Go to next design'),
previousButton: s__('DesignManagement|Go to previous design'),
},
components: { components: {
GlButton, GlButton,
GlButtonGroup, GlButtonGroup,
...@@ -81,7 +85,8 @@ export default { ...@@ -81,7 +85,8 @@ export default {
<gl-button <gl-button
v-gl-tooltip.bottom v-gl-tooltip.bottom
:disabled="!previousDesign" :disabled="!previousDesign"
:title="s__('DesignManagement|Go to previous design')" :title="$options.i18n.previousButton"
:aria-label="$options.i18n.previousButton"
icon="angle-left" icon="angle-left"
class="js-previous-design" class="js-previous-design"
@click="navigateToDesign(previousDesign)" @click="navigateToDesign(previousDesign)"
...@@ -89,7 +94,8 @@ export default { ...@@ -89,7 +94,8 @@ export default {
<gl-button <gl-button
v-gl-tooltip.bottom v-gl-tooltip.bottom
:disabled="!nextDesign" :disabled="!nextDesign"
:title="s__('DesignManagement|Go to next design')" :title="$options.i18n.nextButton"
:aria-label="$options.i18n.nextButton"
icon="angle-right" icon="angle-right"
class="js-next-design" class="js-next-design"
@click="navigateToDesign(nextDesign)" @click="navigateToDesign(nextDesign)"
......
...@@ -84,6 +84,7 @@ export default { ...@@ -84,6 +84,7 @@ export default {
icon="file-tree" icon="file-tree"
class="gl-mr-3 js-toggle-tree-list" class="gl-mr-3 js-toggle-tree-list"
:title="toggleFileBrowserTitle" :title="toggleFileBrowserTitle"
:aria-label="toggleFileBrowserTitle"
:selected="showTreeList" :selected="showTreeList"
@click="setShowTreeList({ showTreeList: !showTreeList })" @click="setShowTreeList({ showTreeList: !showTreeList })"
/> />
......
...@@ -71,6 +71,7 @@ export default { ...@@ -71,6 +71,7 @@ export default {
class="gl-display-none gl-md-display-block text-secondary" class="gl-display-none gl-md-display-block text-secondary"
:loading="isLoading" :loading="isLoading"
:title="title" :title="title"
:aria-label="title"
:icon="isLastDeployment ? 'repeat' : 'redo'" :icon="isLastDeployment ? 'repeat' : 'redo'"
@click="onClick" @click="onClick"
/> />
......
...@@ -14,6 +14,9 @@ import { sprintf, __ } from '~/locale'; ...@@ -14,6 +14,9 @@ import { sprintf, __ } from '~/locale';
import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue'; import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue';
export default { export default {
i18n: {
sendEmail: __('Send email'),
},
name: 'IssuableByEmail', name: 'IssuableByEmail',
components: { components: {
GlButton, GlButton,
...@@ -116,7 +119,8 @@ export default { ...@@ -116,7 +119,8 @@ export default {
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:href="mailToLink" :href="mailToLink"
:title="__('Send email')" :title="$options.i18n.sendEmail"
:aria-label="$options.i18n.sendEmail"
icon="mail" icon="mail"
data-testid="mail-to-btn" data-testid="mail-to-btn"
/> />
......
...@@ -6,8 +6,12 @@ import { ...@@ -6,8 +6,12 @@ import {
GlTooltipDirective, GlTooltipDirective,
GlSafeHtmlDirective as SafeHtml, GlSafeHtmlDirective as SafeHtml,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { __ } from '~/locale';
export default { export default {
i18n: {
editTitleAndDescription: __('Edit title and description'),
},
components: { components: {
GlIcon, GlIcon,
GlButton, GlButton,
...@@ -58,7 +62,8 @@ export default { ...@@ -58,7 +62,8 @@ export default {
<gl-button <gl-button
v-if="enableEdit" v-if="enableEdit"
v-gl-tooltip.bottom v-gl-tooltip.bottom
:title="__('Edit title and description')" :title="$options.i18n.editTitleAndDescription"
:aria-label="$options.i18n.editTitleAndDescription"
icon="pencil" icon="pencil"
class="btn-edit js-issuable-edit qa-edit-button" class="btn-edit js-issuable-edit qa-edit-button"
@click="$emit('edit-issuable', $event)" @click="$emit('edit-issuable', $event)"
......
<script> <script>
import { GlButton, GlTooltipDirective, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import { GlButton, GlTooltipDirective, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { __ } from '~/locale';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import animateMixin from '../mixins/animate'; import animateMixin from '../mixins/animate';
export default { export default {
i18n: {
editTitleAndDescription: __('Edit title and description'),
},
components: { components: {
GlButton, GlButton,
}, },
...@@ -78,7 +82,8 @@ export default { ...@@ -78,7 +82,8 @@ export default {
v-gl-tooltip.bottom v-gl-tooltip.bottom
icon="pencil" icon="pencil"
class="btn-edit js-issuable-edit qa-edit-button" class="btn-edit js-issuable-edit qa-edit-button"
title="Edit title and description" :title="$options.i18n.editTitleAndDescription"
:aria-label="$options.i18n.editTitleAndDescription"
@click="edit" @click="edit"
/> />
</div> </div>
......
...@@ -14,6 +14,7 @@ import { debounce } from 'lodash'; ...@@ -14,6 +14,7 @@ import { debounce } from 'lodash';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import invalidUrl from '~/lib/utils/invalid_url'; import invalidUrl from '~/lib/utils/invalid_url';
import { mergeUrlParams, redirectTo } from '~/lib/utils/url_utility'; import { mergeUrlParams, redirectTo } from '~/lib/utils/url_utility';
import { s__ } from '~/locale';
import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue'; import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue';
import { timeRanges } from '~/vue_shared/constants'; import { timeRanges } from '~/vue_shared/constants';
...@@ -24,6 +25,9 @@ import DashboardsDropdown from './dashboards_dropdown.vue'; ...@@ -24,6 +25,9 @@ import DashboardsDropdown from './dashboards_dropdown.vue';
import RefreshButton from './refresh_button.vue'; import RefreshButton from './refresh_button.vue';
export default { export default {
i18n: {
metricsSettings: s__('Metrics|Metrics Settings'),
},
components: { components: {
GlIcon, GlIcon,
GlButton, GlButton,
...@@ -282,7 +286,8 @@ export default { ...@@ -282,7 +286,8 @@ export default {
data-testid="metrics-settings-button" data-testid="metrics-settings-button"
icon="settings" icon="settings"
:href="operationsSettingsPath" :href="operationsSettingsPath"
:title="s__('Metrics|Metrics Settings')" :title="$options.i18n.metricsSettings"
:aria-label="$options.i18n.metricsSettings"
/> />
</div> </div>
</template> </template>
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
} from '@gitlab/ui'; } from '@gitlab/ui';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { n__, __ } from '~/locale'; import { n__, __, s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -45,6 +45,9 @@ const makeInterval = (length = 0, unit = 's') => { ...@@ -45,6 +45,9 @@ const makeInterval = (length = 0, unit = 's') => {
}; };
export default { export default {
i18n: {
refreshDashboard: s__('Metrics|Refresh dashboard'),
},
components: { components: {
GlButtonGroup, GlButtonGroup,
GlButton, GlButton,
...@@ -148,7 +151,8 @@ export default { ...@@ -148,7 +151,8 @@ export default {
v-gl-tooltip v-gl-tooltip
class="gl-flex-grow-1" class="gl-flex-grow-1"
variant="default" variant="default"
:title="s__('Metrics|Refresh dashboard')" :title="$options.i18n.refreshDashboard"
:aria-label="$options.i18n.refreshDashboard"
icon="retry" icon="retry"
@click="refresh" @click="refresh"
/> />
......
<script> <script>
import { GlTooltipDirective, GlButton } from '@gitlab/ui'; import { GlTooltipDirective, GlButton } from '@gitlab/ui';
import { s__ } from '~/locale';
export default { export default {
i18n: {
buttonLabel: s__('MergeRequests|Resolve this thread in a new issue'),
},
name: 'ResolveWithIssueButton', name: 'ResolveWithIssueButton',
components: { components: {
GlButton, GlButton,
...@@ -23,7 +27,8 @@ export default { ...@@ -23,7 +27,8 @@ export default {
<gl-button <gl-button
v-gl-tooltip v-gl-tooltip
:href="url" :href="url"
:title="s__('MergeRequests|Resolve this thread in a new issue')" :title="$options.i18n.buttonLabel"
:aria-label="$options.i18n.buttonLabel"
class="new-issue-for-discussion discussion-create-issue-btn" class="new-issue-for-discussion discussion-create-issue-btn"
icon="issue-new" icon="issue-new"
/> />
......
<script> <script>
import { GlTooltipDirective, GlLink, GlBadge, GlButton, GlIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlLink, GlBadge, GlButton, GlIcon } from '@gitlab/ui';
import { setUrlParams } from '~/lib/utils/url_utility'; import { setUrlParams } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
import { BACK_URL_PARAM } from '~/releases/constants'; import { BACK_URL_PARAM } from '~/releases/constants';
export default { export default {
i18n: {
editButton: __('Edit this release'),
},
name: 'ReleaseBlockHeader', name: 'ReleaseBlockHeader',
components: { components: {
GlLink, GlLink,
...@@ -69,7 +73,8 @@ export default { ...@@ -69,7 +73,8 @@ export default {
variant="default" variant="default"
icon="pencil" icon="pencil"
class="gl-mr-3 js-edit-button ml-2 pb-2" class="gl-mr-3 js-edit-button ml-2 pb-2"
:title="__('Edit this release')" :title="$options.i18n.editButton"
:aria-label="$options.i18n.editButton"
:href="editLink" :href="editLink"
/> />
</div> </div>
......
...@@ -96,6 +96,7 @@ export default { ...@@ -96,6 +96,7 @@ export default {
v-gl-tooltip v-gl-tooltip
:disabled="!selectedSortOption.sortable" :disabled="!selectedSortOption.sortable"
:title="sortDirectionData.tooltip" :title="sortDirectionData.tooltip"
:aria-label="sortDirectionData.tooltip"
:icon="sortDirectionData.icon" :icon="sortDirectionData.icon"
@click="handleSortDirectionChange" @click="handleSortDirectionChange"
/> />
......
<script> <script>
import { GlButton, GlTooltipDirective, GlIcon } from '@gitlab/ui'; import { GlButton, GlTooltipDirective, GlIcon } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale'; import { __, sprintf, s__ } from '~/locale';
import ReviewerAvatarLink from './reviewer_avatar_link.vue'; import ReviewerAvatarLink from './reviewer_avatar_link.vue';
const LOADING_STATE = 'loading'; const LOADING_STATE = 'loading';
const SUCCESS_STATE = 'success'; const SUCCESS_STATE = 'success';
export default { export default {
i18n: {
reRequestReview: __('Re-request review'),
},
components: { components: {
GlButton, GlButton,
GlIcon, GlIcon,
...@@ -109,7 +112,8 @@ export default { ...@@ -109,7 +112,8 @@ export default {
<gl-button <gl-button
v-else-if="user.can_update_merge_request && user.reviewed" v-else-if="user.can_update_merge_request && user.reviewed"
v-gl-tooltip.left v-gl-tooltip.left
:title="__('Re-request review')" :title="$options.i18n.reRequestReview"
:aria-label="$options.i18n.reRequestReview"
:loading="loadingStates[user.id] === $options.LOADING_STATE" :loading="loadingStates[user.id] === $options.LOADING_STATE"
class="float-right gl-text-gray-500!" class="float-right gl-text-gray-500!"
size="small" size="small"
......
...@@ -65,6 +65,7 @@ export default { ...@@ -65,6 +65,7 @@ export default {
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:title="$options.MSG_COPY" :title="$options.MSG_COPY"
:aria-label="$options.MSG_COPY"
:data-clipboard-text="value" :data-clipboard-text="value"
icon="copy-to-clipboard" icon="copy-to-clipboard"
data-qa-selector="copy_button" data-qa-selector="copy_button"
......
...@@ -56,6 +56,7 @@ export default { ...@@ -56,6 +56,7 @@ export default {
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:title="$options.copyURLTooltip" :title="$options.copyURLTooltip"
:aria-label="$options.copyURLTooltip"
:data-clipboard-text="sshLink" :data-clipboard-text="sshLink"
data-qa-selector="copy_ssh_url_button" data-qa-selector="copy_ssh_url_button"
icon="copy-to-clipboard" icon="copy-to-clipboard"
...@@ -75,6 +76,7 @@ export default { ...@@ -75,6 +76,7 @@ export default {
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:title="$options.copyURLTooltip" :title="$options.copyURLTooltip"
:aria-label="$options.copyURLTooltip"
:data-clipboard-text="httpLink" :data-clipboard-text="httpLink"
data-qa-selector="copy_http_url_button" data-qa-selector="copy_http_url_button"
icon="copy-to-clipboard" icon="copy-to-clipboard"
......
...@@ -363,6 +363,7 @@ export default { ...@@ -363,6 +363,7 @@ export default {
<gl-button <gl-button
v-gl-tooltip v-gl-tooltip
:title="sortDirectionTooltip" :title="sortDirectionTooltip"
:aria-label="sortDirectionTooltip"
:icon="sortDirectionIcon" :icon="sortDirectionIcon"
class="flex-shrink-1" class="flex-shrink-1"
@click="handleSortDirectionClick" @click="handleSortDirectionClick"
......
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
:data-clipboard-target="target" :data-clipboard-target="target"
:data-clipboard-text="text" :data-clipboard-text="text"
:title="title" :title="title"
:aria-label="title"
:category="category" :category="category"
icon="copy-to-clipboard" icon="copy-to-clipboard"
/> />
......
---
title: Add aria labels to icon buttons
merge_request: 57261
author:
type: fixed
...@@ -2902,6 +2902,9 @@ msgstr "" ...@@ -2902,6 +2902,9 @@ msgstr ""
msgid "AlertSettings|Delete integration" msgid "AlertSettings|Delete integration"
msgstr "" msgstr ""
msgid "AlertSettings|Edit integration"
msgstr ""
msgid "AlertSettings|Edit payload" msgid "AlertSettings|Edit payload"
msgstr "" msgstr ""
......
...@@ -13,6 +13,7 @@ exports[`Design management pagination component renders navigation buttons 1`] = ...@@ -13,6 +13,7 @@ exports[`Design management pagination component renders navigation buttons 1`] =
class="gl-mx-5" class="gl-mx-5"
> >
<gl-button-stub <gl-button-stub
aria-label="Go to previous design"
buttontextclasses="" buttontextclasses=""
category="primary" category="primary"
class="js-previous-design" class="js-previous-design"
...@@ -24,6 +25,7 @@ exports[`Design management pagination component renders navigation buttons 1`] = ...@@ -24,6 +25,7 @@ exports[`Design management pagination component renders navigation buttons 1`] =
/> />
<gl-button-stub <gl-button-stub
aria-label="Go to next design"
buttontextclasses="" buttontextclasses=""
category="primary" category="primary"
class="js-next-design" class="js-next-design"
......
...@@ -40,6 +40,7 @@ exports[`Clone Dropdown Button rendering matches the snapshot 1`] = ` ...@@ -40,6 +40,7 @@ exports[`Clone Dropdown Button rendering matches the snapshot 1`] = `
tag="div" tag="div"
> >
<gl-button-stub <gl-button-stub
aria-label="Copy URL"
buttontextclasses="" buttontextclasses=""
category="primary" category="primary"
class="d-inline-flex" class="d-inline-flex"
...@@ -82,6 +83,7 @@ exports[`Clone Dropdown Button rendering matches the snapshot 1`] = ` ...@@ -82,6 +83,7 @@ exports[`Clone Dropdown Button rendering matches the snapshot 1`] = `
tag="div" tag="div"
> >
<gl-button-stub <gl-button-stub
aria-label="Copy URL"
buttontextclasses="" buttontextclasses=""
category="primary" category="primary"
class="d-inline-flex" class="d-inline-flex"
......
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