Skip to content

Commit ff11e79

Browse files
committed
feat(Breadcrumbs): add ariaLabel to improve accessibility
1 parent a297a7b commit ff11e79

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/orbit-components/src/Breadcrumbs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ The Table below contains all types of props available in the Breadcrumbs compone
2121
| Name | Type | Default | Description |
2222
| :----------- | :------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------- |
2323
| dataTest | `string` | | Optional prop for testing purposes. |
24-
| id | `string` | | Set `id` for `Breadcrumbs` |
24+
| id | `string` | | Set `id` for `Breadcrumbs`. |
2525
| **children** | `React.Node` | | The content of the Breadcrumbs, normally [`BreadcrumbsItem`](#breadcrumbsitem). |
2626
| onGoBack | `event => void \| Promise` | | Callback for handling back button action. If present the back button is visible. |
2727
| backHref | `string` | | The location for the back button to direct to. Turns the back button into a link when present (renders as an `a` element). |
2828
| goBackTitle | `React.Node` | `"Back"` | Translation string for the go back link on mobile, defined when onGoBack is defined. |
29-
| |
3029
| spaceAfter | `enum` | | Additional `margin-bottom` after component. |
30+
| ariaLabel | `string` | | Optional prop for `aria-label`. |
3131

3232
### enum
3333

packages/orbit-components/src/Breadcrumbs/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const Breadcrumbs = ({
1818
spaceAfter,
1919
backHref,
2020
id,
21+
ariaLabel = "Breadcrumb",
2122
}: Props) => {
2223
const childEls = React.Children.toArray(children) as React.ReactElement<BreadcrumbsItemProps>[];
2324

@@ -26,7 +27,7 @@ const Breadcrumbs = ({
2627
<Hide on={["smallMobile", "mediumMobile"]}>
2728
<nav
2829
className={cx("font-base text-small", spaceAfter && spaceAfterClasses[spaceAfter])}
29-
aria-label="Breadcrumb"
30+
aria-label={ariaLabel}
3031
id={id}
3132
data-test={dataTest}
3233
>

packages/orbit-components/src/Breadcrumbs/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export interface Props extends Common.Globals, Common.SpaceAfter {
1010
readonly goBackTitle?: React.ReactNode;
1111
readonly onGoBack?: Common.Event<React.SyntheticEvent<HTMLAnchorElement>>;
1212
readonly backHref?: string;
13+
readonly ariaLabel?: string;
1314
}

0 commit comments

Comments
 (0)