Skip to content

Commit 280bcd2

Browse files
fix(ui-kit): expose PaginationEllipsis More pages outside aria-hidden
Move aria-hidden from the ellipsis wrapper onto the decorative icon so the sr-only label stays in the accessibility tree. Closes #10052 Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1d2b142 commit 280bcd2

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

packages/loopover-ui-kit/src/components/pagination.test.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { render, screen } from "@testing-library/react";
22
import { describe, expect, it } from "vitest";
33

44
import {
5+
PaginationEllipsis,
56
PaginationLink,
67
PaginationNext,
78
PaginationPrevious,
@@ -47,3 +48,30 @@ describe("PaginationLink aria-disabled styling (#8307)", () => {
4748
expect(link.getAttribute("aria-current")).toBe("page");
4849
});
4950
});
51+
52+
// #10052: aria-hidden on the outer wrapper removed the sr-only "More pages" label from the a11y tree.
53+
// Scope aria-hidden to the decorative icon only — same pattern as TypingIndicator.
54+
describe("PaginationEllipsis sr-only label not inside aria-hidden (#10052)", () => {
55+
it("exposes \"More pages\" with no aria-hidden ancestor; icon is aria-hidden", () => {
56+
const { container } = render(<PaginationEllipsis />);
57+
const label = screen.getByText("More pages");
58+
expect(label.closest("[aria-hidden='true'], [aria-hidden='']")).toBeNull();
59+
const icon = container.querySelector("svg");
60+
expect(icon).not.toBeNull();
61+
expect(icon!.getAttribute("aria-hidden")).toBe("true");
62+
});
63+
64+
it("merges caller className through cn (mx-2 + h-9)", () => {
65+
const { container } = render(<PaginationEllipsis className="mx-2" />);
66+
const outer = container.firstElementChild as HTMLElement;
67+
expect(outer.tagName).toBe("SPAN");
68+
expect(outer.className).toContain("mx-2");
69+
expect(outer.className).toContain("h-9");
70+
});
71+
72+
it("lets an explicit aria-hidden prop win on the outer span", () => {
73+
const { container } = render(<PaginationEllipsis aria-hidden />);
74+
const outer = container.firstElementChild as HTMLElement;
75+
expect(outer.getAttribute("aria-hidden")).toBe("true");
76+
});
77+
});

packages/loopover-ui-kit/src/components/pagination.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,10 @@ const PaginationEllipsis = ({
9999
...props
100100
}: React.ComponentProps<"span">) => (
101101
<span
102-
aria-hidden
103102
className={cn("flex h-9 w-9 items-center justify-center", className)}
104103
{...props}
105104
>
106-
<MoreHorizontal className="h-4 w-4" />
105+
<MoreHorizontal className="h-4 w-4" aria-hidden />
107106
<span className="sr-only">More pages</span>
108107
</span>
109108
);

0 commit comments

Comments
 (0)