A mobile menu built as a panel
A mobile menu panel counts as accessible not by its appearance but by how it behaves with a keyboard.
A mobile menu looks simple, but it is where accessibility most often breaks. This is not checked with a screenshot but by trying to use it without a mouse.
What the behaviour must do
- The open button reports its state through
aria-expandedand says which element the panel is controlled by. Escapecloses the panel.- Closing returns focus to the open button.
- Following a link closes the panel — otherwise it stays on top of the new page.
The theme switch inside the menu
If the panel is the only place where the theme switch is available on mobile, it needs to be marked up as a standalone block with a label rather than hidden behind an unexplained icon.
Checklist
- Open it from the keyboard without touching the screen.
Tabthrough all the items.- Close it with
Escapeand check that focus has returned to the button.
- accessibility
- navigation