Skip to content

il nav section

Nicholas Hoyt edited this page Nov 12, 2021 · 33 revisions

Overview

Key Assertions

  1. The Tab key (plus Shift+Tab) should be the primary keyboard affordance for moving through website navigation menus.
  2. The Enter or Return key should be used for selecting either a menu (to expand its submenu) or a menu item (to follow its link).
  3. You should not have to tab through every submenu link to move from one menu to the next. This can be accomplished by making each top-level menu button a toggle.
  4. Use of the arrow keys for navigating through menus may be added as an enhancement, but should not be required.

The WAI-ARIA Authoring Practices 1.2 recommended design pattern for website navigation menus utilizes the Disclosure widget.

From ARIA Authoring Practices 1.2: Disclosure (Show/Hide)

A disclosure is a widget that enables content to be either collapsed (hidden) or expanded (visible). It has two elements: a disclosure button and a section of content whose visibility is controlled by the button.

The two ARIA Authoring Practices 1.2 examples that illustrate the use of disclosure widgets in a website menu system are:

Regarding the examples, and the explanation for why the Disclosure Navigation Menu patterns are recommended instead of using the menu and menubar roles:

From ARIA Authoring Practices 1.2:

Although this example uses the word "menu" in the colloquial sense to refer to a set of navigation links, it does not use the WAI-ARIA menu role. That is because the menu and menubar roles require complex functionality, such as composite widget focus management and first-character navigation, that is unnecessary for typical site navigation.

Additionally, the Disclosure Navigation Menu patterns are thought to more closely match website users' expectations regarding keyboard navigation: users expect that in website menu systems, they will be navigating lists of links (as opposed to lists of actions to be performed in the context of an application).

This leads to the following conclusion: If users expect that navigation menus contain lists of links, since these are interactive elements that are, by default, keyboard accessible by using the Tab key, this inherently implies that they would primarily use the Tab key to move through those lists of links.

The Disclosure Navigation Menu patterns make use of this idiom (using the Tab key to move through lists of links) by creating a "Tab hierarchy" in the following way:

  • When you tab to the first top-level menu button, you are given a choice: (1) tab to the next top-level menu button, or (2) hit enter, return, or spacebar to interact with the button, which exposes the button's submenu, places focus on the first menu item in the submenu, and allows for tabbing through the remainder of its links.
  • Note: This choice is communicated to screen reader users by informing them that they are on a button that toggles additional content. [Verify and explain how this works] When the button is selected, screen reader software will inform the user of how many items are in the submenu.
  • Thus the choice allows you to either tab through all of the top-level buttons in series, or to interact with a particular submenu when the label of the top-level button indicates that its submenu is the one you are seeking.

Accessibility Issues

  1. Assuming the above-referenced expectation for navigating through links via the Tab key, the current keyboard navigation scheme forces users to tab through each top-level menu button's submenu items in order to reach the next top-level menu. While there is a keyboard shortcut to get to the next or previous menu using the left and right arrow keys:

    • This is not a behavior that is easily discoverable.
    • The arrow key behaviors are considered optional behaviors in the ARIA Disclosure Navigation Menu design patterns.
    • The right and left arrow key behaviors in the current system are different from those described in the ARIA Disclosure Navigation Menu design patterns (see the ARIA 1.2 examples listed below).
  2. Also, in the current system, there is no way (other than using the Escape key) to close a menu, once it is open, and using the right or left arrow keys to move from one open menu to the next or previous menu results in the submenu content always being exposed to screen reader users (unless they discover that they can use the Escape key to close the menu to hide that content in each instance of advancing to the next or previous menu).

  3. In the current system, the top-level menu buttons do not act as toggles, and therefore should not have the 'button' role. The top-level "buttons" are simply links, with the following behaviors built in to them:

    • When a top-level button includes a link, hitting return or enter takes you to the target of the link.
    • When a top-level button does not include a link, it is my understanding (unable to find any example pages for this) that hitting return or enter will take you to the target of the first item in the button's submenu. This violates the WCAG requirement that the link text should describe the target of the link.
    • When a top-level button (with or without link) receives focus or hover events, the button's submenu is exposed. It can be closed only by using the Escape key, or navigating through the submenu until reaching the end, which takes you to the next top-level menu button (if one exists) or the next focusable element on the page. This means that all users, including screen reader users, who are attempting to navigate (tab through) the top-level menu buttons will also be presented, upon reaching each new button, with all of the content contained in the button's submenu.

References

Clone this wiki locally