From b91997218720b322653391652f33e923a6f31c04 Mon Sep 17 00:00:00 2001 From: Marie Lucca Date: Thu, 9 Jan 2025 10:22:39 -0500 Subject: [PATCH] Revert "Pagination: Accessibility enhancements (#5488)" This reverts commit e352e192dae7ae7b24420f4afae08871536c0484. --- .changeset/eighty-carpets-rush.md | 5 ----- .../src/Pagination/Pagination.stories.tsx | 20 ++++--------------- packages/react/src/Pagination/model.tsx | 4 ++-- 3 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 .changeset/eighty-carpets-rush.md diff --git a/.changeset/eighty-carpets-rush.md b/.changeset/eighty-carpets-rush.md deleted file mode 100644 index 829d5dae13d..00000000000 --- a/.changeset/eighty-carpets-rush.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@primer/react": patch ---- - -Pagination: Hides the `Pagination` Previous and Next buttons from the accessibility tree when they are disabled. diff --git a/packages/react/src/Pagination/Pagination.stories.tsx b/packages/react/src/Pagination/Pagination.stories.tsx index 9cc2d4e4c91..271e6612b7f 100644 --- a/packages/react/src/Pagination/Pagination.stories.tsx +++ b/packages/react/src/Pagination/Pagination.stories.tsx @@ -1,4 +1,4 @@ -import React, {useState} from 'react' +import React from 'react' import type {Meta, StoryFn} from '@storybook/react' import type {ComponentProps} from '../utils/types' import Pagination from './Pagination' @@ -26,21 +26,9 @@ const parseShowPagesArg = (value: boolean | string) => { } } -export const Default = () => { - const [page, setPage] = useState(2) - - return ( - { - e.preventDefault() - setPage(n) - }} - showPages={{narrow: false}} - /> - ) -} +export const Default = () => ( + e.preventDefault()} showPages={{narrow: false}} /> +) export const Playground: StoryFn> = ({showPages, ...args}) => { return ( diff --git a/packages/react/src/Pagination/model.tsx b/packages/react/src/Pagination/model.tsx index 2883f802444..f4a1e449027 100644 --- a/packages/react/src/Pagination/model.tsx +++ b/packages/react/src/Pagination/model.tsx @@ -148,7 +148,7 @@ export function buildComponentData( key = 'page-prev' content = 'Previous' if (page.disabled) { - Object.assign(props, {'aria-hidden': 'true'}) + Object.assign(props, {'aria-disabled': 'true', role: 'link'}) } else { Object.assign(props, { rel: 'prev', @@ -163,7 +163,7 @@ export function buildComponentData( key = 'page-next' content = 'Next' if (page.disabled) { - Object.assign(props, {'aria-hidden': 'true'}) + Object.assign(props, {'aria-disabled': 'true', role: 'link'}) } else { Object.assign(props, { rel: 'next',