From 5d5102b5ac51c21847d43061edf79dfce3251a10 Mon Sep 17 00:00:00 2001 From: Josiah Ivey Date: Tue, 23 Apr 2024 13:36:01 -0700 Subject: [PATCH 1/2] make the progress bar accessible as breadcrumbs --- src/components/ProgressBar.tsx | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/components/ProgressBar.tsx b/src/components/ProgressBar.tsx index 816b7fc..b8f37ed 100644 --- a/src/components/ProgressBar.tsx +++ b/src/components/ProgressBar.tsx @@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck'; import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark'; -const ProgressBarWrapper = styled.div` +const ProgressBarWrapper = styled.nav` display: flex; justify-content: flex-start; flex-wrap: wrap; @@ -131,18 +131,25 @@ export type ProgressBarItemVariant = 'isCorrect' | 'isIncorrect' | 'isStatus' | export const ProgressBarItem = ({index, isActive, step, goToStep}: ProgressBarItemProps) => - goToStep(index, step)}> + goToStep(index, step)} + aria-current={isActive ? 'location' : 'false'} + aria-label={step.variant === 'isStatus' ? 'Assignment status' : `Step ${index + 1}` } + > {step.variant === 'isStatus' ? : index + 1} ; -export const ProgressBar = ({ steps, activeIndex, goToStep }: ProgressBarProps) => - {steps.map((step, index) => )} -; +export const ProgressBar = ({ steps, activeIndex, goToStep }: ProgressBarProps) => + + {steps.map((step, index) => )} + ; From dee390f99c717c6619883955de6ce90d0620d202 Mon Sep 17 00:00:00 2001 From: Josiah Ivey Date: Thu, 25 Apr 2024 10:07:35 -0700 Subject: [PATCH 2/2] update snapshots --- .../__snapshots__/ProgressBar.spec.tsx.snap | 57 +++++++++++++++++-- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/src/components/__snapshots__/ProgressBar.spec.tsx.snap b/src/components/__snapshots__/ProgressBar.spec.tsx.snap index 6e29d9d..df598f3 100644 --- a/src/components/__snapshots__/ProgressBar.spec.tsx.snap +++ b/src/components/__snapshots__/ProgressBar.spec.tsx.snap @@ -1,13 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ProgressBar matches snapshot 1`] = ` -
-
+ `; exports[`ProgressBar matches snapshot when active step is incomplete 1`] = ` -
-
+ `; exports[`ProgressBar matches snapshot when status step is active 1`] = ` -
-
+ `;