Skip to content

Commit

Permalink
fix(ProgressBar): adds focus outline
Browse files Browse the repository at this point in the history
Updates `ProgressBar` to show focus outline for screenreader only text.
  • Loading branch information
aresnik11 authored Feb 5, 2025
1 parent 7638bb7 commit d12d013
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/gamut/src/ProgressBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const ProgressBarWrapper = styled.div<ProgressBarElementWrapperProps>`
${progressBarBackgroundVariants};
${progressBarSizeVariants};
${progressBarBackgroundOverride};
${progressBarFlatVariants}
${progressBarFlatVariants};
`;

const Bar = styled(Box)(progressBarForegroundVariants);
Expand All @@ -170,15 +170,18 @@ export const ProgressBar: React.FC<ProgressBarProps> = ({
variant,
}) => {
const showBarBorder = percent > 0 || minimumPercent > 0;
const id = React.useId();
return (
<ProgressBarWrapper
aria-labelledby={id}
aria-live="polite"
role="figure"
flat={flat}
size={size}
variant={variant}
backgroundOverride={Pattern ? 'pattern' : 'none'}
>
<Text as="label" screenreader>{`Progress: ${percent}%`}</Text>
<Text as="label" id={id} screenreader>{`Progress: ${percent}%`}</Text>
{Pattern && <Pattern width="100%" position="absolute" zIndex={0} />}
<Bar
variant={variant}
Expand Down

0 comments on commit d12d013

Please sign in to comment.