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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user