Feature Library

Hold to confirm, four ways

<0.01 CPU ms
A still of the Hold to confirm, four ways demo
Still
The live demo starts when it’s in view.Press and hold a button (mouse, touch, or Space/Enter) · let go, slide off or Esc to cancel · a quick tap shows the hint

A safe button for actions that cost something: it acts only after being held.

What it costs a frame

<0.01 ms
GPU
not used
CPU, median
<0.01 ms
CPU, 95th pct
0.10 ms
Draw calls
0
Weight
Light

Measured 7 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with the three cards holding themselves in turn from code (two holds in three confirm, one is let go at 55%): the cost is the core stepping three holds and the skins redrawing (the shift lights, the bent bar’s SVG, one CSS number for the grid). Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed<0.010.10
apple · Apple A19 Proin a browser tab · 16 November 2026not timed0.020.10
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed0.010.21

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Delete, wipe and reset
  2. Launch, publish and deploy
  3. Purchases and in-game spending
  4. Admin and fleet tools
  5. Kiosks and touch screens

Pitfalls, in brief

  1. A screen reader in browse mode activates a button with a bare click, which cannot hold: handle onBareClick (the demo logs it) by offering another way, such as a confirm dialog, or the action is out of reach for those users.
  2. Never act on click: the core cancels the click itself (Enter would otherwise fire it on key down, and a form would submit).
  3. Keep the hold short (about 0.8 to 1.5 s) and show progress from the first frame after the grace: a long hold with no feedback reads as broken.
  4. The grace is what makes a tap safe; at 0 every brush of the button starts a hold.
  5. On touch the browser captures the pointer to the button; the core lets go of the capture so sliding off cancels.
6 more in brief
  1. navigator.vibrate works only after a user gesture and only on some platforms (Android browsers, not iOS or desktops): treat haptics as a bonus, never the only feedback.
  2. The light grid needs @property (registered in light-grid.css) for the tracer to spin; the fill, ring and brackets work without it.
  3. The tunnel draws outside its dialog panel, behind it: nothing round the panel may clip (overflow), and a dialog layer inside a demo or app view needs isolation: isolate on that view so its z-index stays under the page’s own chrome.
  4. The tunnel’s frames and streaks are WAAPI animations whose playbackRate follows the hold; they start on the first hold and pause once the tunnel has faded, so an open dialog at rest costs nothing.
  5. Put the tunnel skin on the dialog panel and give the panel a background: the skin paints that background again (::after, background: inherit) over the tunnel, so the streaks never cross the dialog’s text.
  6. stop() also disposes the skin: call it once, when the view unmounts.
11 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

hold to confirmdestructive actionsaccessibilitykeyboardtouchhaptics@propertydialogmodalWAAPIsvgdomcssno dependencies

Near it in the frame