StealThis .dev

Form — Inline edit / edit-in-place

A profile details panel where Name, Email, Role, and Bio each display a value beside a pencil button. Clicking Edit swaps the row into an inline input with Save and Cancel; Enter saves, Esc cancels, Save runs real validation and flashes a Saved check, Cancel restores the original. Only one row is editable at a time, focus moves into the field on edit, and an aria-live region announces every outcome. Built with vanilla JavaScript, accessible states, and a responsive layout.

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

Code

Inline edit / edit-in-place

An account profile panel built as a description list of rows — Full name, Email, Workspace role, and Bio. Each row shows its current value next to an unobtrusive pencil button that fades in on hover or keyboard focus. Activating Edit swaps that single row from read mode into an inline field (text input, email, select, or textarea) with Save and Cancel actions, and focus jumps straight into the field so editing starts immediately.

Editing is deliberately constrained to one row at a time: opening a second row commits-or-cancels the first, keeping the panel calm and the state unambiguous. Pressing Enter saves single-line fields (Cmd/Ctrl+Enter for the bio), Esc cancels and restores the original value, and clicking outside the edit form quietly cancels. Save runs real validation — required checks, an email format rule, and a 160-character bio limit — surfacing inline error text with aria-invalid, an error toast, and a polite aria-live announcement. A successful save flashes a green “Saved” check, fires a confirmation toast, and reveals an “Unsaved changes” badge.

The whole pattern is vanilla JavaScript with no dependencies. It ships full focus-visible rings, error/success/disabled field states, WCAG-AA contrast, a live status region for assistive tech, smooth (motion-reduced-aware) transitions, and a layout that collapses from a two-column grid to a stacked single column below 520px.