RaijinStudios

Lab: components

Accessible components that work with a keyboard.

Tabs, a modal dialog and an accordion, written with plain HTML, CSS and a few lines of JavaScript. No framework, no plugin, nothing to keep patched.

Why it matters

Menus and pop-ups are where sites break.

Custom widgets are the most common place a business site becomes unusable for keyboard and screen-reader users: a pop-up that traps nobody, tabs that cannot be reached, a menu that cannot be closed. Getting them right protects your customers, your reputation and your legal position.

Tabs

Click a tab, or focus one and use the Left and Right arrow keys. Home and End jump to the first and last tab.

We review your current site, your customers and your goals, then agree a fixed quote before any work starts.

Open the dialog, then press Tab repeatedly: focus stays inside. Escape or the close button closes it and returns focus here.

Book a call

This dialog uses the native dialog element, so the page behind it is inert. We also add an explicit focus trap as a safety net.

Accordion and live announcement

Each heading holds a button that reports whether it is expanded. Everything starts collapsed.

What is under the hood

  • Tabs use the ARIA tab pattern: role=tablist, aria-selected, aria-controls and a roving tabindex so only the active tab is in the Tab order.
  • The modal is a native dialog opened with showModal(), plus a Tab and Shift+Tab handler that wraps focus inside it.
  • The accordion toggles aria-expanded and the hidden attribute.
  • All of it is one script file on our own domain. No inline code, so the Content-Security-Policy can forbid it.

Back to the lab

Search this site

Type to search the site.

Ctrl K / ⌘K to open, ↑ ↓ to move, Enter to go, Esc to close.