diff --git a/src/components/VHeader/VFilterButton.vue b/src/components/VHeader/VFilterButton.vue index 33f9e55243..fa62b8565c 100644 --- a/src/components/VHeader/VFilterButton.vue +++ b/src/components/VHeader/VFilterButton.vue @@ -1,25 +1,26 @@ @@ -31,14 +32,12 @@ import { defineEvent } from "~/types/emits" import { useI18n } from "~/composables/use-i18n" import VButton from "~/components/VButton.vue" -import VIcon from "~/components/VIcon/VIcon.vue" - -import filterIcon from "~/assets/icons/filter.svg" +import VFilterIconOrCounter from "~/components/VHeader/VFilterIconOrCounter.vue" export default defineComponent({ name: "VFilterButton", components: { - VIcon, + VFilterIconOrCounter, VButton, }, props: { @@ -61,26 +60,16 @@ export default defineComponent({ const filterCount = computed(() => searchStore.appliedFilterCount) const filtersAreApplied = computed(() => filterCount.value > 0) - /** - * This label's verbosity makes it useful for the aria-label - * where it is also used, especially on mobile where the - * label would just be the number of applied filters, and therefore - * basically useless as far as a label is concerned! - */ - const xlMinLabel = computed(() => - filtersAreApplied.value - ? i18n.tc("header.filter-button.with-count", filterCount.value) - : i18n.t("header.filter-button.simple") - ) - const lgMaxLabel = computed(() => - filtersAreApplied ? filterCount.value : "" + const textLabel = computed(() => i18n.t("header.filter-button.simple")) + const ariaLabel = computed(() => + i18n.tc("header.filter-button.with-count", filterCount.value) ) return { - filterIcon, - xlMinLabel, - lgMaxLabel, + ariaLabel, + textLabel, filtersAreApplied, + filterCount, } }, }) diff --git a/src/components/VHeader/VFilterIconOrCounter.vue b/src/components/VHeader/VFilterIconOrCounter.vue new file mode 100644 index 0000000000..3eef350d9a --- /dev/null +++ b/src/components/VHeader/VFilterIconOrCounter.vue @@ -0,0 +1,40 @@ + + diff --git a/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue b/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue index c7cfb82d43..5595910fd9 100644 --- a/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue +++ b/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue @@ -38,7 +38,9 @@ size="medium" class="label-regular gap-x-2" > - {{ $t("filters.title") }}{{ + $t("filters.title") + }} { const filterButtonText = await page .locator('[aria-controls="filters"] span:visible') .textContent() - expect(filterButtonText).toContain("1") + expect(filterButtonText).toContain("Filters") } else { const filtersAriaLabel = (await page