Estimated reading time : 4 min · Published
Separate destination and disclosure
Decide whether each section title opens a page or reveals a list. If both functions matter, expose them as distinct controls. A small arrow beside a link is insufficient if the entire area changes between navigation and disclosure by device.
Label the trigger Menu or Navigation rather than relying on three lines alone. Match section labels to destination pages. Main navigation need not reproduce a whole catalogue: it can lead to indexes that offer search and filters.
Choose a simple panel or a real interruption
The W3C disclosure navigation example distinguishes ordinary links from ARIA application menus. Site navigation generally does not require a menu role and software-menu commands. Keep links and a control communicating expansion state.
If the page remains usable outside the panel, do not describe it as modal. If the panel covers and blocks all other content, provide a true interruption with closing and focus return. Its visual and assistive-technology behaviour must agree.
Fictional test case: a button opens a list identified as nav-services. aria-controls="nav-services" must reference that actual identifier, while aria-expanded describes the state currently displayed. These attributes do not implement opening. In the W3C disclosure model, Enter and Space activate the button; Escape closes the list and returns focus to its control. Tab and Shift + Tab retain the usual path through controls and links. Arrow keys are an optional addition and do not replace tabbing.
Distinguish this from a modal panel: it receives focus when opened, prevents background interaction and keeps tabbing inside until closed. aria-modal="true" does not install these behaviours by itself. A simple non-modal submenu must not trap focus. If a width change hides the active control, provide a visible, logical focus destination. The W3C example is educational guidance: test the implementation with the browser and assistive-technology combinations you actually support.
Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.
| Situation | State or control | Observable result |
|---|---|---|
| Closed list | aria-expanded="false" | No hidden link in the tab sequence |
| Open, non-modal list | aria-expanded="true" | Links reachable; Tab can leave navigation |
| Close with Escape | Escape | Focus returns to the opening button |
| Switch to another width | aria-expanded / focus | Display, state and visible focus remain consistent |
Test state and width changes
Open a submenu on desktop, narrow the window, then widen it again. Check that styles and states leave no invisible focusable links or ineffective controls. Closed panels must also leave the keyboard sequence.
Test a long translated label, zoom and an already-scrolled page. Navigation should not permanently obscure the title or block access to content. If background scrolling stops while open, restore normal behaviour after closing and after following a link.
Example: a section with an overview page
Educational example: Services opens an overview, while a neighbouring button reveals categories. On mobile, Menu exposes both functions with their labels. Testing opens a category, closes navigation and returns with Back. The useful section remains identifiable without an overlay preventing reading.
Check a component whose width changes when a side panel opens.
Synthetic case: a side panel reduces menu space without resizing the window. Test long labels and high zoom. Use CSS when sufficient; if JavaScript must react to size, avoid a correction that causes another size change indefinitely. Observe the component’s available space rather than only the screen width.
- The menu remains usable within its container and no resize loop blocks the interface.
- MDN Resize Observer
API reporting changes in an element’s size independently of window resizing.
Reference documents
- W3C disclosure navigation example · Source consulted
- W3C WAI : Modal dialog · Source consulted
- MDN Resize Observer · Source consulted
Content updated on
