Handle up/down as well as left/right for horizontal toolbars for improved a11y (#12305)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-03-06 14:41:14 +00:00 committed by GitHub
parent 942fabc5a8
commit 8bd74f517c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,8 +53,9 @@ const Toolbar = forwardRef<HTMLDivElement, IProps>(({ children, ...props }, ref)
}
};
// We handle both up/down and left/right as is allowed in the above WAI ARIA best practices
return (
<RovingTabIndexProvider handleHomeEnd handleLeftRight onKeyDown={onKeyDown}>
<RovingTabIndexProvider handleHomeEnd handleLeftRight handleUpDown onKeyDown={onKeyDown}>
{({ onKeyDownHandler }) => (
<div {...props} onKeyDown={onKeyDownHandler} role="toolbar" ref={ref}>
{children}