fix(a11y): a labelled rail row says its label and the exact unread count, not the capped badge first (E28)

With the labels on, the row's name was its text, badge first: 15 unread was heard as "9+ Alerts". The
name is now the visible label plus the count, as the icon-only row's is, and the drawn badge is hidden.
This commit is contained in:
2026-09-25 23:59:20 +02:00
parent 6088e476a7
commit 69edeecc45
2 changed files with 25 additions and 5 deletions
@@ -46,6 +46,22 @@ describe("NavRailItem", () => {
const row = screen.getByRole("button", { name: "Alerts" });
expect(row.getAttribute("aria-current")).toBeNull();
});
// E28 audit: labelled, the name was the row's text, the corner badge first, so 20 unread was heard
// as "9+Alerts" where the icon-only row says "Notifications (20)".
it("labelled with a count: the visible label, then the exact count", () => {
render(
<NavRailItem
icon={Bell}
label="Notifications"
shortLabel="Alerts"
showLabel
badge={20}
onClick={() => {}}
/>,
);
expect(screen.getByRole("button", { name: "Alerts (20)" })).toBeTruthy();
});
});
// F32: the rail's footer (language, About, Sign out) drew 32 and 36 squares with 16 and 20px glyphs