Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Make `label` prop required for VIconButton (#954)
Olga Bulat58dc3c6fc78a
diff --git a/frontend/src/components/VAudioTrack/VPlayPause.vue b/frontend/src/components/VAudioTrack/VPlayPause.vueindex 7237fd26e..6a9dd14e6 100644--- a/frontend/src/components/VAudioTrack/VPlayPause.vue+++ b/frontend/src/components/VAudioTrack/VPlayPause.vue@@ -4,7 +4,7 @@:tabindex="isTabbable ? 0 : -1"class="play-pause flex-shrink-0 border-dark-charcoal bg-dark-charcoal text-white focus-visible:border-pink focus-visible:shadow-ring focus-visible:outline-none active:shadow-ring disabled:opacity-70":icon-props="icon === undefined ? undefined : { iconPath: icon }"- :aria-label="$t(label)"+ :label="$t(label)":button-props="buttonProps"@click.stop.prevent="handleClick"@mousedown="handleMouseDown"diff --git a/frontend/src/components/VBanner/VNotificationBanner.vue b/frontend/src/components/VBanner/VNotificationBanner.vueindex fc8643293..8a641475d 100644--- a/frontend/src/components/VBanner/VNotificationBanner.vue+++ b/frontend/src/components/VBanner/VNotificationBanner.vue@@ -12,7 +12,7 @@<VIconButton:class="{ 'text-white': variant === 'announcement' }"size="small"- :aria-label="$t('modal.close')"+ :label="$t('modal.close')":icon-props="{iconPath: closeIcon,}"diff --git a/frontend/src/components/VContentReport/VContentReportPopover.vue b/frontend/src/components/VContentReport/VContentReportPopover.vueindex 86cb7fc64..1e5acf00e 100644--- a/frontend/src/components/VContentReport/VContentReportPopover.vue+++ b/frontend/src/components/VContentReport/VContentReportPopover.vue@@ -13,7 +13,7 @@<VIconButtonclass="absolute top-0 border-none text-dark-charcoal-70 end-0":icon-props="{ iconPath: icons.closeSmall }"- :aria-label="$t('modal.close').toString()"+ :label="$t('modal.close')"@click="close"/><VContentReportFormdiff --git a/frontend/src/components/VExternalSearch/VExternalSourceList.vue b/frontend/src/components/VExternalSearch/VExternalSourceList.vueindex 67f2c7de1..772a6723e 100644--- a/frontend/src/components/VExternalSearch/VExternalSourceList.vue+++ b/frontend/src/components/VExternalSearch/VExternalSourceList.vue@@ -3,7 +3,7 @@<VIconButtonclass="absolute top-0 border-none text-dark-charcoal-70 end-0":icon-props="{ iconPath: icons.closeSmall }"- :aria-label="$t('modal.close').toString()"+ :label="$t('modal.close')"@click="$emit('close')"/><h2 class="description-bold mb-2 px-4 pt-5 text-start">diff --git a/frontend/src/components/VFilters/VFilterChecklist.vue b/frontend/src/components/VFilters/VFilterChecklist.vueindex 118acf3f0..c163c5857 100644--- a/frontend/src/components/VFilters/VFilterChecklist.vue+++ b/frontend/src/components/VFilters/VFilterChecklist.vue@@ -40,7 +40,7 @@<template #default="{ close }"><div class="relative"><VIconButton- :aria-label="getLicenseExplanationCloseAria(item.code)"+ :label="getLicenseExplanationCloseAria(item.code)"class="absolute top-0 border-none text-dark-charcoal-70 end-0"size="small":icon-props="{ iconPath: icons.closeSmall }"diff --git a/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue b/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vueindex 0bb7fc628..f1ac1da4b 100644--- a/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue+++ b/frontend/src/components/VGlobalAudioSection/VGlobalAudioSection.vue@@ -6,7 +6,7 @@class="absolute top-0 z-30 border-none ltr:right-0 rtl:left-0"size="large":icon-props="{ iconPath: icons.closeIcon }"- :aria-label="$t('audio-track.close')"+ :label="$t('audio-track.close')"@click="handleClose"/></div>diff --git a/frontend/src/components/VHeader/VHeaderDesktop.vue b/frontend/src/components/VHeader/VHeaderDesktop.vueindex 82baeb335..57275d1ed 100644--- a/frontend/src/components/VHeader/VHeaderDesktop.vue+++ b/frontend/src/components/VHeader/VHeaderDesktop.vue@@ -19,7 +19,7 @@<VSearchBarButtonv-show="searchTerm !== ''":icon-path="closeIcon"- :aria-label="$t('browse-page.search-form.clear')"+ :label="$t('browse-page.search-form.clear')"inner-area-classes="bg-white hover:bg-dark-charcoal-10"class="hidden group-focus-within:flex"@click="clearSearchTerm"diff --git a/frontend/src/components/VHeader/VHeaderInternal.vue b/frontend/src/components/VHeader/VHeaderInternal.vueindex fb3c47759..7336b69b6 100644--- a/frontend/src/components/VHeader/VHeaderInternal.vue+++ b/frontend/src/components/VHeader/VHeaderInternal.vue@@ -16,7 +16,7 @@id="menu-button"ref="menuButtonRef":icon-props="{ iconPath: menuIcon }"- :aria-label="$t('header.aria.menu')"+ :label="$t('header.aria.menu')"v-bind="triggerA11yProps"class="border-tx hover:bg-dark-charcoal hover:text-white":class="{ 'bg-dark-charcoal text-white': isModalVisible }"@@ -59,7 +59,7 @@ref="closeButton":icon-props="{ iconPath: closeIcon }"class="border-tx text-white focus-visible:ring-yellow focus-visible:ring-offset-0"- :aria-label="$t('modal.close')"+ :label="$t('modal.close')"@click="closePageMenu"/></div>diff --git a/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsButton.vue b/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsButton.vueindex fddc178c0..85e1efdb7 100644--- a/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsButton.vue+++ b/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsButton.vue@@ -2,7 +2,7 @@<VSearchBarButtonid="content-settings-button":icon-path="sourceIcon"- :aria-label="+ :label="appliedFilterCount? $tc('header.content-settings-button.with-count', appliedFilterCount): $t('header.content-settings-button.simple')diff --git a/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue b/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vueindex 8bc270b01..34a886af8 100644--- a/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue+++ b/frontend/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue@@ -38,7 +38,7 @@<VIconButtonclass="self-center ms-auto hover:bg-dark-charcoal hover:text-white":icon-props="{ iconPath: closeIcon }"- :aria-label="$t('modal.aria-close')"+ :label="$t('modal.aria-close')"@click="close"/></template>diff --git a/frontend/src/components/VHeader/VHeaderMobile/VHeaderMobile.vue b/frontend/src/components/VHeader/VHeaderMobile/VHeaderMobile.vueindex 1e61fa5a9..573d8ffb2 100644--- a/frontend/src/components/VHeader/VHeaderMobile/VHeaderMobile.vue+++ b/frontend/src/components/VHeader/VHeaderMobile/VHeaderMobile.vue@@ -34,7 +34,7 @@v-show="searchBarIsActive":icon-path="chevronLeftIcon":inner-size="8"- :aria-label="$t('header.back-button')"+ :label="$t('header.back-button')":rtl-flip="true"inner-area-classes="bg-dark-charcoal-10 hover:bg-dark-charcoal hover:text-white"@click="handleBack"@@ -70,7 +70,7 @@<VSearchBarButtonv-show="searchBarIsActive && searchTerm":icon-path="closeIcon"- :aria-label="$t('browse-page.search-form.clear')"+ :label="$t('browse-page.search-form.clear')"inner-area-classes="bg-white hover:bg-dark-charcoal-10"@click="clearSearchText"/>diff --git a/frontend/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue b/frontend/src/components/VHeader/VHeaderMobile/VSearchBarButton.vueindex 3bb63c0ba..24229e845 100644--- a/frontend/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue+++ b/frontend/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue@@ -1,6 +1,7 @@<template><VIconButtonclass="border-tx bg-tx"+ :label="label":button-props="{ variant: 'plain--avoid' }"v-on="$listeners">@@ -27,6 +28,8 @@ import { defineComponent, PropType } from "vue"import VIcon from "~/components/VIcon/VIcon.vue"import VIconButton from "~/components/VIconButton/VIconButton.vue"+import type { TranslateResult } from "vue-i18n"+/*** The buttons placed inside the mobile search bar in the header.* They are based on the VIconButton, look like they have a smallish focus area@@ -66,6 +69,13 @@ export default defineComponent({type: Boolean,default: false,},+ /**+ * The label to use as accessible name for the button (aria-label).+ */+ label: {+ type: [String, Object] as PropType<string | TranslateResult>,+ required: true,+ },},})</script>diff --git a/frontend/src/components/VHeader/meta/VSearchBarButton.stories.mdx b/frontend/src/components/VHeader/meta/VSearchBarButton.stories.mdxindex 5d6cf28db..8171cbab3 100644--- a/frontend/src/components/VHeader/meta/VSearchBarButton.stories.mdx+++ b/frontend/src/components/VHeader/meta/VSearchBarButton.stories.mdx@@ -46,7 +46,7 @@ import sourceIcon from "~/assets/icons/source.svg"/>export const Template = (args) => ({- template: `<div class="bg-white"><VSearchBarButton v-bind="args" v-on="args" /></div>`,+ template: `<div class="bg-white"><VSearchBarButton label="VSearchBarButton" v-bind="args" v-on="args" /></div>`,components: { VSearchBarButton },setup() {if (!args.iconPath) {@@ -69,7 +69,7 @@ export const Template = (args) => ({export const contentSettingsTemplate = (args) => ({template: `<div class="bg-dark-charcoal-10 rounded-sm flex justify-end">- <VContentSettingsButton :are-filters-selected="true" v-bind="args" />+ <VContentSettingsButton label="VContentSettingsButton" :are-filters-selected="true" v-bind="args" /></div>`,components: { VContentSettingsButton },@@ -97,13 +97,13 @@ export const activeButtonsTemplate = (args) => ({<VSearchBarButton:icon-path="chevronLeftIcon":inner-size="8"- :aria-label="$t('header.back-button')"+ :label="$t('header.back-button')"inner-area-classes="hover:bg-dark-charcoal hover:text-white":rtl-flip="true"/><VSearchBarButton:icon-path="closeIcon"- :aria-label="$t('browse-page.search-form.clear')"+ :label="$t('browse-page.search-form.clear')"inner-area-classes="bg-white hover:bg-dark-charcoal-10"/></div>`,diff --git a/frontend/src/components/VIconButton/VIconButton.vue b/frontend/src/components/VIconButton/VIconButton.vueindex 47a84ef23..41061bdf8 100644--- a/frontend/src/components/VIconButton/VIconButton.vue+++ b/frontend/src/components/VIconButton/VIconButton.vue@@ -1,6 +1,7 @@<template><VButtonv-bind="buttonProps"+ :aria-label="label"size="disabled"class="icon-button flex flex-shrink-0 items-center justify-center border-1.5":class="buttonSizeClasses"@@ -25,6 +26,8 @@ import type { ButtonType } from "~/types/button"import VIcon, { type IconProps } from "~/components/VIcon/VIcon.vue"import VButton, { type ButtonProps } from "~/components/VButton.vue"+import type { TranslateResult } from "vue-i18n"+const SIZE_MAP = Object.freeze({tiny: { icon: 6, button: "w-6 h-6" },small: { icon: 6, button: "w-10 h-10" },@@ -63,6 +66,13 @@ export default defineComponent({type: Object as PropType<ButtonProps>,default: () => ({ variant: "plain" }),},+ /**+ * the label for the button; This is used for accessibility purposes.+ */+ label: {+ type: [String, Object] as PropType<string | TranslateResult>,+ required: true,+ },},setup(props, { attrs }) {const type = (attrs["type"] ?? "button") as ButtonTypediff --git a/frontend/src/components/VIconButton/meta/VIconButton.stories.mdx b/frontend/src/components/VIconButton/meta/VIconButton.stories.mdxindex 9232a4bdb..c213589e6 100644--- a/frontend/src/components/VIconButton/meta/VIconButton.stories.mdx+++ b/frontend/src/components/VIconButton/meta/VIconButton.stories.mdx@@ -24,7 +24,7 @@ import replayIcon from "~/assets/icons/replay.svg"export const Template = (args) => ({template: `- <VIconButton class="text-white bg-dark-charcoal border-dark-charcoal" v-bind="args"/>+ <VIconButton class="text-white bg-dark-charcoal border-dark-charcoal" v-bind="args" label="v-icon-button" />`,components: { VIconButton },setup() {@@ -39,6 +39,7 @@ export const sizesTemplate = (args) => ({<p>{{ size }}</p><VIconButtonclass="text-white bg-dark-charcoal border-dark-charcoal"+ label="v-icon-button":size="size" v-bind="args" /></div></div>