mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
fix(a11y): name every control by the text it shows
axe 4.14 checks WCAG 2.5.3 (label in name), and the app frame failed it on every page: the account link, the user menu and the day strip carried an aria-label that left out their visible text. The same class sat in the coverage meter, the score ring, medication links, instrument cards, filter pills with a value set, cycle calendar days (named by an ISO key), admin user and login rows, a few sort and action buttons, and the French, Spanish, Italian and Polish weekday chips, whose abbreviations were not part of the day names. Controls with visible text are now named by it, with any extra purpose added as screen-reader text; the select pill and calendar days spell out a name that contains what they show. The day and conversation strips keep their action as the tooltip.
This commit is contained in:
1 parent
038f8b10cd
commit
562ff8a277
36 files changed
+134
-97
No files matched your search
@@ -514,10 +514,8 @@ test.describe("Coach page frame", () => {
|
||||
expect(await stripBox(strip(page))).toEqual(stripOpen);
|
||||
await expect(expand(page)).toBeFocused();
|
||||
await expect(expand(page)).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(expand(page)).toHaveAttribute(
|
||||
"aria-label",
|
||||
"Show conversations",
|
||||
);
|
||||
// Named by its visible label; the action is the tooltip (WCAG 2.5.3).
|
||||
await expect(expand(page)).toHaveAttribute("title", "Show conversations");
|
||||
await expect(
|
||||
panel(page).locator('[data-slot="coach-history-select"]'),
|
||||
).toHaveCount(0);
|
||||
|
||||
@@ -192,7 +192,9 @@ test.describe("the day view", () => {
|
||||
await expect(expand).toBeFocused();
|
||||
await expect(expand).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(expand).toHaveAttribute("aria-controls", "day-docked-panel");
|
||||
expect(await expand.getAttribute("aria-label")).toMatch(/^Show /);
|
||||
// Named by its visible date (WCAG 2.5.3); the action is the tooltip.
|
||||
expect(await expand.getAttribute("aria-label")).toBeNull();
|
||||
expect(await expand.getAttribute("title")).toMatch(/^Show /);
|
||||
expect((await rail.boundingBox())!.width).toBeLessThanOrEqual(40);
|
||||
|
||||
// Another page: the edge is still there and brings the same day back,
|
||||
|
||||
Reference in new issue
Block a user