Optional Keyboard Support
Accessible Menu supports keyboard navigation out of the box. However, for Disclosure Menus and Top Link Disclosure Menus there are additional keybindings that are optional in the ARIA Authoring Practices Guide (APG).
Specifically, the APG states that the following keybindings should be optional:
- Down Arrow : Moves focus to the next item.
- Right Arrow : Moves focus to the next item.
- Up Arrow : Moves focus to the previous item.
- Left Arrow : Moves focus to the previous item.
- Home : Moves focus to the first item.
- End : Moves focus to the last item.
See the Keyboard Support section for a full breakdown of the optional key support.
To enable these optional keybindings, you can use the optionalKeySupport
option.
js
// DisclosureMenu is used in this example.
// TopLinkDisclosureMenu supports the optionalKeySupport option as well.
new DisclosureMenu({
menuElement: document.querySelector("nav ul"),
optionalKeySupport: true, // Default: false.
});