Skip to content

Commit

Permalink
[@mantine/nprogress] Add option to add aria-label (#2526)
Browse files Browse the repository at this point in the history
Co-authored-by: zulianrizki <you@example.com>
  • Loading branch information
zulianrizki and zulianrizki committed Sep 24, 2022
1 parent bce104d commit a51eb56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/src/docs/others/nprogress.mdx
Expand Up @@ -108,3 +108,11 @@ export default function App(props: AppProps) {
);
}
```

## Accessibility

`NavigationProgress` uses `Progress` component under the hood, to pass `aria-label` use `progressLabel` props

```tsx
<NavigationProgress progressLabel="Loading Page" />
```
5 changes: 5 additions & 0 deletions src/mantine-nprogress/src/NavigationProgress.tsx
Expand Up @@ -42,6 +42,9 @@ export interface NavigationProgressProps {

/** Progressbar z-index */
zIndex?: React.CSSProperties['zIndex'];

/** aria-label for `Progress`*/
progressLabel?: string;
}

export function NavigationProgress({
Expand All @@ -56,6 +59,7 @@ export function NavigationProgress({
autoReset = false,
withinPortal = true,
zIndex = getDefaultZIndex('max'),
progressLabel,
}: NavigationProgressProps) {
const theme = useMantineTheme();
const shouldReduceMotion = useReducedMotion();
Expand Down Expand Up @@ -167,6 +171,7 @@ export function NavigationProgress({
transitionDuration: `${reducedMotion || !mounted ? 0 : transitionDuration}ms`,
},
}}
aria-label={progressLabel}
/>
)}
</OptionalPortal>
Expand Down

0 comments on commit a51eb56

Please sign in to comment.