From 9ad371da6f394e1cd5d8624a735fd24bc567d34d Mon Sep 17 00:00:00 2001 From: langemike Date: Mon, 25 Nov 2024 12:27:36 +0100 Subject: [PATCH] fix: accessibility improvements for Hero shelf pagination and LayoutGrid * fix(a11y): rowindex and colindex must start from 1 * fix(a11y): hero shelf pagination list aria markup --- .../__snapshots__/CardGrid.test.tsx.snap | 8 +- .../__snapshots__/Favorites.test.tsx.snap | 8 +- .../HeroShelf/HeroShelf.module.scss | 4 +- .../HeroShelf/HeroShelfPagination.tsx | 82 ++++++++++--------- .../src/components/LayoutGrid/LayoutGrid.tsx | 4 +- .../User/__snapshots__/User.test.tsx.snap | 8 +- 6 files changed, 58 insertions(+), 56 deletions(-) diff --git a/packages/ui-react/src/components/CardGrid/__snapshots__/CardGrid.test.tsx.snap b/packages/ui-react/src/components/CardGrid/__snapshots__/CardGrid.test.tsx.snap index 7eb8d1a4d..888929dbd 100644 --- a/packages/ui-react/src/components/CardGrid/__snapshots__/CardGrid.test.tsx.snap +++ b/packages/ui-react/src/components/CardGrid/__snapshots__/CardGrid.test.tsx.snap @@ -9,12 +9,12 @@ exports[` > renders and matches snapshot 1`] = ` role="grid" >
> renders and matches snapshot 1`] = `
> renders and matches snapshot 1`] = `
> renders and matches snapshot 1`] = ` role="grid" >
> renders and matches snapshot 1`] = `
> renders and matches snapshot 1`] = `
+ <>
{t('slide_indicator', { page: indexIn + 1, pages: playlist.playlist.length })}
-
    - {playlistWithPlaceholders.map((current, itemIndex) => { - if (itemIndex < index - range - 1 || itemIndex > index + range + 1) { - return null; - } - if (!current) { - return
+ + ); }; diff --git a/packages/ui-react/src/components/LayoutGrid/LayoutGrid.tsx b/packages/ui-react/src/components/LayoutGrid/LayoutGrid.tsx index f3e337db6..e77431452 100644 --- a/packages/ui-react/src/components/LayoutGrid/LayoutGrid.tsx +++ b/packages/ui-react/src/components/LayoutGrid/LayoutGrid.tsx @@ -116,13 +116,13 @@ const LayoutGrid = ({ className, columnCount, data, renderC return (
{Array.from({ length: rowCount }).map((_, rowIndex) => ( -
+
{data.slice(rowIndex * columnCount, rowIndex * columnCount + columnCount).map((item, columnIndex) => (
diff --git a/packages/ui-react/src/pages/User/__snapshots__/User.test.tsx.snap b/packages/ui-react/src/pages/User/__snapshots__/User.test.tsx.snap index aa8fe5729..a7d60dbac 100644 --- a/packages/ui-react/src/pages/User/__snapshots__/User.test.tsx.snap +++ b/packages/ui-react/src/pages/User/__snapshots__/User.test.tsx.snap @@ -416,12 +416,12 @@ exports[`User Component tests > Favorites Page 1`] = ` role="grid" >
Favorites Page 1`] = `
Favorites Page 1`] = `