Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Improve accessibility labels for filters tab and button (#4396)
Madison Swain-Bowden848f2abb46d8
diff --git a/frontend/src/components/VHeader/VHeaderMobile/VFilterTab.vue b/frontend/src/components/VHeader/VHeaderMobile/VFilterTab.vueindex 4f3f55ce3..36f79548d 100644--- a/frontend/src/components/VHeader/VHeaderMobile/VFilterTab.vue+++ b/frontend/src/components/VHeader/VHeaderMobile/VFilterTab.vue@@ -1,5 +1,10 @@<template>- <VTab id="filters" size="medium" class="gap-x-2">+ <VTab+ id="filters"+ size="medium"+ class="gap-x-2"+ :aria-label="$tc('header.filterButton.withCount', appliedFilterCount)"+ ><VFilterIconOrCounter :applied-filter-count="appliedFilterCount" /><h2 class="label-regular">{{ $t("filters.title") }}</h2></VTab>diff --git a/frontend/src/locales/scripts/en.json5 b/frontend/src/locales/scripts/en.json5index 7722656bb..488b9ddc0 100644--- a/frontend/src/locales/scripts/en.json5+++ b/frontend/src/locales/scripts/en.json5@@ -52,7 +52,8 @@loading: "Loading...",filterButton: {simple: "Filters",- withCount: "{count} Filter|{count} Filters",+ /** Used as the accessible label for the button or tab that opens the filters sidebar. Count refers the number of filters the user has enabled, not the number of available filters */+ withCount: "Filters ({count})",},seeResults: "See results",backButton: "Go back",diff --git a/frontend/test/locales/ar.json b/frontend/test/locales/ar.jsonindex 91bcda2e7..6754a03ed 100644--- a/frontend/test/locales/ar.json+++ b/frontend/test/locales/ar.json@@ -52,7 +52,7 @@"loading": "جار التحميل...","filterButton": {"simple": "مرشحات",- "withCount": "{count} عامل التصفية | {count} عوامل التصفية"+ "withCount": "({count}) مرشح"},"seeResults": "انظر النتائج","backButton": "عُد",diff --git a/frontend/test/playwright/utils/navigation.ts b/frontend/test/playwright/utils/navigation.tsindex e6565db33..95aa095ff 100644--- a/frontend/test/playwright/utils/navigation.ts+++ b/frontend/test/playwright/utils/navigation.ts@@ -52,9 +52,15 @@ export const openContentSettingsTab = async (tab: "searchTypes" | "filters" = "searchTypes",dir: LanguageDirection = "ltr") => {- const tabKey = tab === "searchTypes" ? "searchType.heading" : "filters.title"-- await page.getByRole("tab", { name: t(tabKey, dir) }).click()+ // Use a hard-coded Regex to match the dynamic Filters tab name+ const tabName =+ tab === "searchTypes"+ ? t("searchType.heading", dir)+ : dir === "ltr"+ ? /filter/i+ : /مرش/++ await page.getByRole("tab", { name: tabName }).click()}/**