StealThis .dev

Wiki — Version / Language Switcher

A self-contained docs header cluster pairing an accessible version dropdown (v3.2 latest, v3.1, v3.0, v2.x with latest and EOL badges) and a language dropdown (English, Español, 日本語, Deutsch, Português). Selecting an older release raises a dismissible outdated-version banner with a one-click jump to latest, while picking a language swaps a localized last-updated string. Both menus open with click or keyboard, support arrow, Home, End, Enter and Escape navigation, manage focus correctly, and close on outside click.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Version / Language Switcher

A documentation header for the fictional Aurora DB knowledge base, built around two accessible custom dropdowns. The version switcher lists release lines — v3.2 (carrying a green latest badge), the maintenance builds v3.1 and v3.0, and the legacy v2.x line marked EOL. The language switcher offers English, Español, 日本語, Deutsch and Português, each with a flag and native name. Both sit in a real sample doc header, complete with a sidebar, breadcrumb, and an article on cluster topology.

Choosing any release other than v3.2 raises an amber “you are viewing an old version” banner that names the selected version and offers a one-click jump back to latest; the banner is also dismissible. Switching languages updates a small localized “last updated” string and the document lang attribute, and a toast confirms each change.

The dropdowns are keyboard-first. They open with Enter, Space, or the arrow keys, move the active option with //Home/End, commit with Enter, and close with Esc — restoring focus to the trigger. They use a listbox/option ARIA pattern, close on outside click or Tab, and the layout collapses the sidebar to a drawer and condenses the switchers below 820px and 520px.

Illustrative UI only — fictional articles, products, and data.