Skip to content

Commit

Permalink
fix(VerticalNavigation): arial labels added to navigation slider butt…
Browse files Browse the repository at this point in the history
…ons (#3556)
  • Loading branch information
MEsteves22 committed Aug 3, 2023
1 parent b05c0ac commit 739fe55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const HvVerticalNavigationHeader = ({
{...others}
>
{isOpen && headerTitle && slider && (
<HvButton icon onClick={backButtonClickHandler} {...backButtonProps}>
<HvButton icon onClick={backButtonClickHandler} aria-label="Back" {...backButtonProps}>
<Backwards iconSize="XS" />
</HvButton>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export interface HvVerticalNavigationTreeProps
* target - the behavior when opening an url.
*/
data?: NavigationData[];
/** Aria label to apply to the navigate to submenu button on the navigation slider list items. */
sliderForwardButtonAriaLabel?: string;
}

const createListHierarchy = (
Expand Down Expand Up @@ -200,6 +202,8 @@ export const HvVerticalNavigationTree = ({
defaultSelected,
onChange,

sliderForwardButtonAriaLabel = "Navigate to submenu",

...others
}: HvVerticalNavigationTreeProps) => {
const [selected, setSelected] = useControlled(selectedProp, defaultSelected);
Expand Down Expand Up @@ -399,6 +403,7 @@ export const HvVerticalNavigationTree = ({
selected={selected}
onNavigateToTarget={navigateToTargetHandler}
onNavigateToChild={navigateToChildHandler}
forwardButtonAriaLabel={sliderForwardButtonAriaLabel}
/>
) : (
<HvVerticalNavigationTreeView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export interface HvVerticalNavigationSliderProps {
event: React.MouseEvent<HTMLButtonElement>,
item: NavigationData
) => void;
/** Aria label to apply to the navigate to submenu button on the list items. */
forwardButtonAriaLabel?: string;
}

export const HvVerticalNavigationSlider = ({
Expand All @@ -59,6 +61,7 @@ export const HvVerticalNavigationSlider = ({
selected,
onNavigateToTarget,
onNavigateToChild,
forwardButtonAriaLabel = "Navigate to submenu",
}: HvVerticalNavigationSliderProps) => {
return (
<HvListContainer interactive id={id}>
Expand Down Expand Up @@ -89,6 +92,7 @@ export const HvVerticalNavigationSlider = ({
onClick={(event) => {
onNavigateToChild?.(event, item);
}}
aria-label={forwardButtonAriaLabel}
>
<DropRightXS />
</HvButton>
Expand Down

0 comments on commit 739fe55

Please sign in to comment.