fix(pagination): hide mobile page label from AT tree with aria-hidden
The mobile 'Seite X von Y' span had aria-current='page', which created two elements announcing the current page on wide screens: the hidden mobile label and the active desktop button. On sm:+ screens the mobile span is display:none (removed from AT tree), but on small screens both the span and the desktop button were redundant. Replace aria-current with aria-hidden='true' on the mobile label so AT always relies on the desktop button's aria-current. Updates spec test accordingly and adds a second assertion in a broader test context (Decision Queue #1). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,11 +19,11 @@ describe('Pagination', () => {
|
||||
await expect.element(label).toHaveTextContent(/10/);
|
||||
});
|
||||
|
||||
it('marks the current page label with aria-current="page"', async () => {
|
||||
it('mobile page label is aria-hidden (desktop buttons carry the aria-current role)', async () => {
|
||||
render(Pagination, { page: 0, totalPages: 3, makeHref });
|
||||
|
||||
const label = page.getByTestId('pagination-page-label');
|
||||
await expect.element(label).toHaveAttribute('aria-current', 'page');
|
||||
await expect.element(label).toHaveAttribute('aria-hidden', 'true');
|
||||
});
|
||||
|
||||
describe('page number buttons', () => {
|
||||
@@ -144,6 +144,13 @@ describe('Pagination', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('mobile page label is aria-hidden so screen readers skip it on wide screens', async () => {
|
||||
render(Pagination, { page: 2, totalPages: 10, makeHref });
|
||||
|
||||
const label = page.getByTestId('pagination-page-label');
|
||||
await expect.element(label).toHaveAttribute('aria-hidden', 'true');
|
||||
});
|
||||
|
||||
it('renders prev as a link pointing at page - 1 when not on first page', async () => {
|
||||
render(Pagination, { page: 4, totalPages: 10, makeHref });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user