Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/nprogress] NavigationProgress: add progressLabel props #2526

Merged
merged 1 commit into from Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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