diff --git a/components/breadcrumbs/README.md b/components/breadcrumbs/README.md index b52e3813c5b..af9f63937e0 100644 --- a/components/breadcrumbs/README.md +++ b/components/breadcrumbs/README.md @@ -28,124 +28,120 @@ Breadcrumbs are a way-finding tool that helps users understand where they are w -## Responsive Behavior - -Breadcrumbs that overflow their container will appear to fade at the edge. +## Breadcrumbs [d2l-breadcrumbs] - + ```html - - - - + + + ``` -This works well for mobile or other touch devices but not as well for mouse or keyboard users, so we have two other options for managing width. + +### Properties -### Limited Width +| Property | Type | Description | +|--|--|--| +| `compact` | Boolean | Renders in compact mode, displaying only the last item | + -Set a `max-width` to constrain breadcrumbs to a particular width: +## Breadcrumb (child) [d2l-breadcrumb] - + ```html - - - + + ``` -### Compact Mode + +### Properties -Alternately, add the `compact` attribute to only display the last breadcrumb. The `d2l-breadcrumb-current-page` will be hidden: +| Property | Type | Description | +|--|--|--| +| `text` | String, required | The text of the breadcrumb link | +| `aria-label` | String | ARIA label for the breadcrumb, used if `text` does not provide enough context for screen reader users | +| `href` | String | The Url that breadcrumb is pointing to | +| `target` | String | Target of the breadcrumb item | + - +## Current Page [d2l-breadcrumb-current-page] + +Only include the current page in the breadcrumb if your page or view does not have a visible heading. You will notice that some older pages or tools in Brightspace still display the current page as the last breadcrumb despite having a visible page heading, but this is now a legacy pattern. + + ```html - + ``` -## Breadcrumbs [d2l-breadcrumbs] +## Responsive Behavior - +Breadcrumbs that overflow their container will appear to fade at the edge, as in this example: + + ```html - - - + + + + + ``` - -### Properties - -| Property | Type | Description | -|--|--|--| -| `compact` | Boolean | Indicates whether the component should render in compact mode | - +### Limited Width -## Breadcrumb (child) [d2l-breadcrumb] +Set a `max-width` to constrain breadcrumbs to a particular width: - + ```html - - + + + ``` - -### Properties - -| Property | Type | Description | -|--|--|--| -| `text` | String, required | Text of the breadcrumb item | -| `aria-label` | String | AriaLabel of breadcrumb item | -| `href` | String | Href of the breadcrumb item | -| `target` | String | Target of the breadcrumb item | - - -### Accessibility Properties - -To make your usage of `d2l-breadcrumb` (child) accessible, use the following attribute when applicable: - -| Attribute | Description | -|---|---| -| `aria-label` | Acts as a primary label. Use if `text` does not provide enough context. | - -## Current Page [d2l-breadcrumb-current-page] +### Compact Mode -Only include the current page in the breadcrumb if your page or view does not have a visible heading. You will notice that some older pages or tools in Brightspace still display the current page as the last breadcrumb despite having a visible page heading, but this is now a legacy pattern. +Alternately, add the `compact` attribute to only display the last breadcrumb. The `d2l-breadcrumb-current-page` will be hidden: - + ```html - + ``` +## Accessibility + +Breadcrumbs adhere to [W3C's Breadcrumbs Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/), so they are contained in a navigation landmark region with proper aria labelling and add `aria-current` to the final breadcrumb if it represents the [Current Page](#d2l-breadcrumb-current-page). + +Note that we do not apply a `visited` style to breadcrumbs, since they reflect tool hiearchy and are part of the UI rather than part of the page content. diff --git a/components/breadcrumbs/breadcrumb.js b/components/breadcrumbs/breadcrumb.js index 4b58f64bacf..48524ac137a 100644 --- a/components/breadcrumbs/breadcrumb.js +++ b/components/breadcrumbs/breadcrumb.js @@ -32,12 +32,12 @@ class Breadcrumb extends RtlMixin(FocusMixin(LitElement)) { */ target: { type: String, reflect: true }, /** - * REQUIRED: text of the breadcrumb link + * REQUIRED: The text of the breadcrumb link * @type {string} */ text: { type: String, reflect: true }, /** - * ARIA label of the breadcrumb + * ACCESSIBILITY: ARIA label for the breadcrumb, used if `text` does not provide enough context for screen reader users * @type {string} */ ariaLabel: { attribute: 'aria-label', type: String, reflect: true }