StealThis .dev

Form — Long sectioned form (sticky nav)

A long single-page settings form split into five cards — Profile, Account, Notifications, Billing, and Security — with a sticky scroll-spy side nav that highlights the active section as you move through the page. Dirty-field tracking reveals a floating Save changes bar, real vanilla-JS validation surfaces inline errors and an accessible error summary on save, and a confirmation toast lands once everything is stored.

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

Code

Long sectioned form (sticky nav)

A workspace settings page broken into five card sections — Profile, Account, Notifications, Billing, and Security — laid out beside a sticky left side-nav. An IntersectionObserver scroll-spy keeps the active nav item in sync as you scroll, and clicking any item smoothly scrolls to that card while moving focus to it for keyboard users. On narrow screens the side-nav collapses into a horizontal, scrollable tab strip pinned to the top.

Every field carries a clear label, placeholder, and helper text, with toggles, radios, a live character counter, a card-number auto-formatter, and a password-strength meter. The moment any field changes, the form is marked dirty: a header pill flips to “Unsaved changes” and a floating Save changes bar slides up with Discard and Save actions. The browser also warns before you navigate away with pending edits.

Saving runs real validation — required fields, email and handle patterns, a 16-digit card check, ZIP and password rules, and a confirm-password match. Failures populate an accessible role="alert" error summary with jump links, mark fields with aria-invalid plus inline messages, and scroll focus to the first problem. A clean pass simulates an async save, resets the dirty state, and confirms with a success toast.