--- id: Navigation section: components --- import { Checkbox, List, ListItem } from '@patternfly/react-core'; ## Accessibility To implement an accessible PatternFly **navigation** component: - Provide an accessible name for the navigation via the `aria-label` attribute - For grouped or expandable nav, add a `title` to each section to distinguish them for users. If `title` is not used, an `aria-label` must be used on the `NavGroup` or `NavExpandable` component. ## Testing At a minimum, a navigation component should meet the following criteria: The navigation has an accessible name via the aria-label} description="This will differentiate each navigation when announced to users of assistive technologies when navigating through a page or a screen reader's rotor menu." /> Tab navigates to the next focusable element, and Shift + Tab navigates to the previous focusable element. Expandable items can be opened with Enter or Space. When the navigation is collapsed, you should not be able to navigate to any of the elements.} /> For expandable or grouped navigation, an accessible name via the title or aria-label is used.} description="This will differentiate each navigation when announced to users of assistive technologies when navigating through a page or a screen reader's rotor menu." /> ## React customization The following React props have been provided for more fine-tuned control over accessibility. | Prop | Applied to | Reason | |---|---|---| | `aria-label="[text that labels the nav component]"` | `Nav` | Adds an accessible label for the nav when there are multiple navs on the page | | `ariaLeftScroll="[text that labels the left scroll button]"` | `NavList` | Adds an aria-label for the left scroll button | | `ariaRightScroll="[text that labels the right scroll button]"` | `NavList` | Adds an aria-label for the right scroll button | | `id` | `NavGroup` | Used as an identifier to use when there is an `aria-labelledby` on a section element | | `title="[text label for an expandable nav]"` | `NavGroup` | Adds a title shown for the group | | `isActive` | `NavItem` | Will add the `aria-current` attribute on a nav item when active | | `isExpanded` | `NavExpandable` | Adds the `aria-expanded` attribute when is expanded and `hidden` attribute when collapsed | | `title` | `NavExpandable` | Adds a title shown for the expandable list | | `buttonProps={[an object containing button props]}` | `NavExpandable` | Adds any additional props added to the NavExpandable `