Skip to content

Commit

Permalink
Merge pull request #597 from Availity/a11y/breadcrumb
Browse files Browse the repository at this point in the history
refactor(mui-breadcrumbs): add default aria-label on the Breadcrumbs …
  • Loading branch information
gregmartDOTin authored Dec 9, 2024
2 parents 3fc4185 + 7615173 commit 379e5ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/breadcrumbs/src/lib/Breadcrumbs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const _Breadcrumbs: StoryObj<typeof Breadcrumbs> = {
render: (args: BreadcrumbsProps) => <Breadcrumbs {...args} />,
args: {
active: 'Current Page',
'aria-label': 'test-breadcrumbs',
crumbs: [{ name: 'Previous Page', url: '#' }],
},
};
Expand Down
4 changes: 4 additions & 0 deletions packages/breadcrumbs/src/lib/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export interface BreadcrumbsProps extends Omit<MuiBreadcrumbsProps, 'separator'
/** Url for the Home route.
* @default /public/apps/dashboard */
homeUrl?: string;
/** A string value that can be used to name an element
* @default breadcrumbs */
'aria-label'?: string;
}

const Breadcrumb = ({ name, url, target = '_top' }: Crumb) => {
Expand All @@ -54,6 +57,7 @@ export const Breadcrumbs = ({
separator={<NavigateNextIcon fontSize="xsmall" />}
slotProps={{ collapsedIcon: { className: 'breadcrumbs__collapsed-icon' } }}
slots={{ CollapsedIcon: MoreHorizontalIcon }}
aria-label={rest['aria-label'] || 'breadcrumbs'}
>
<Link aria-label="Home" href={homeUrl} loadApp={false}>
Home
Expand Down

0 comments on commit 379e5ac

Please sign in to comment.