Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accessibility labels for filters tab and button #4396

Merged
merged 8 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/scripts/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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})",
AetherUnbound marked this conversation as resolved.
Show resolved Hide resolved
},
seeResults: "See results",
backButton: "Go back",
Expand Down
2 changes: 1 addition & 1 deletion frontend/test/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"loading": "جار التحميل...",
"filterButton": {
"simple": "مرشحات",
"withCount": "{count} عامل التصفية | {count} عوامل التصفية"
"withCount": "({count}) مرشح"
},
"seeResults": "انظر النتائج",
"backButton": "عُد",
Expand Down
12 changes: 9 additions & 3 deletions frontend/test/playwright/utils/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

/**
Expand Down