-
Notifications
You must be signed in to change notification settings - Fork 2
Accessible Interactions
Interactive behavior lives mainly in assets/js/main.js. It must work with a keyboard, mouse, touchscreen, and assistive technology such as a screen reader.
These rules apply to every interactive component.
- Use a
buttonfor an action on the current page. - Use an
alink to move to another address. - Do not add an
hrefto a disabled button (or, comment it out). - Do not add a role that describes behavior the control does not actually have.
- Keep visible keyboard focus outlines.
Press Tab and Shift+Tab to move through controls. Use Enter and Space to operate them without a mouse.
The following components have additional requirements because their visible and interactive states change.
If you change the mobile menu, confirm that it:
- tells assistive technology whether it is open or closed;
- keeps keyboard focus inside the open menu;
- prevents hidden menu controls from receiving focus;
- closes when Escape is pressed;
- closes after a navigation link is selected;
- returns focus to the menu button when appropriate;
- prevents the page behind it from scrolling;
- closes and restores scrolling when the browser crosses the desktop breakpoint.
The instruction cards behave differently depending on the input device.
With a mouse or another precise pointer:
- hover and focus can reveal the back;
- the front instruction button and Back button are hidden and removed from keyboard navigation.
With touch or a coarse pointer:
- visible buttons control the flip;
- the active button is enabled and keyboard-accessible.
On a hybrid device, using touch must not permanently break later mouse behavior.
Only the visible card side should be available to a keyboard or screen reader. The code uses inert, aria-hidden, and focus settings for this; update them together.
After editing assets/js/main.js, run:
node --check assets/js/main.jsThis only finds basic code mistakes. Also test the feature in a browser with Escape, Tab, Shift+Tab, a mouse, and touch input where possible. Resize across the mobile/desktop breakpoint.
Return to Styling and Interactions.