Feature Library

Interactions with zero JavaScript

<0.01 CPU ms
A still of the Interactions with zero JavaScript demo
Still
The live demo starts when it’s in view.Click, Tab and the arrows on any control · scroll the bars · Sections: open one, and the open one closes

Eight patterns that run with no script, each one CSS file and the markup it reads.

What it costs a frame

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

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured while the demo walks itself through the patterns (a new one every 2.5 s, the camera flying to a new place in between): style, layout and paint of CSS-only interactions. No script runs in the patterns; the demo only checks radios. 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.01<0.01
apple · Apple A19 Proin a browser tab · 16 November 2026not timed<0.010.02
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed<0.010.01

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. Pages that work with scripts off
  2. Static, docs and server-rendered pages
  3. Tabs and switches with a sliding indicator
  4. A settings panel or inspector, one section open at a time
  5. Questions and answers that fold
  6. Sorting and filtering a short list
  7. A day or a history you scrub by scrolling
  8. Figures and clocks that count
  9. Animated flows on a map or diagram
  10. A 3D overview that flies to places
  11. Widgets that fit any panel

Pitfalls, in brief

  1. Radio and checkbox names are page-wide: give every instance its own name (each markup function takes one), or two lists on a page will share one sort.
  2. :has() cannot hold another :has(), not even inside :is(): such a rule is invalid and the browser drops all of it, silently.
  3. The static CSS reaches options by position, with a line for each: tabs up to 8, sorts and periods up to 6, filters up to 4, presets 6.
  4. Theme colours (--pci-accent, --pci-accent-2, the camera’s sky, sea and land, the scrubber’s night, day and haze, the map’s land) can be set on any ancestor.
  5. Sorting keeps one pre-sorted copy of the rows a sort, so the reading order is the order you see.
13 more in brief
  1. Counters are generated content: screen readers do not reliably read them, and never announce their changes.
  2. Where anchor-scope is missing (Chrome has it from 131; check the others before you rely on it), the anchor name is page-wide and the last checked tab on the page wins: with two sets of tabs, give the second its own name (anchor-name and position-anchor both take var()).
  3. The scrubber’s scroller is right to left (dir="rtl", each bar back to ltr) so it opens at the newest bar with no script; its keyframes run newest first.
  4. offset-distance is not one of the properties browsers reliably animate off the main thread (transform and opacity are): keep the marks to tens, and let Calm or reduced motion pause them.
  5. Each terrace is a full-size 3D layer with a drop-shadow filter: about 3 MB of texture each at 1000 × 760 and 1×, four times that on a 2× screen.
  6. clip-path: path() and offset-path: path() are in pixels of the element’s box and do not scale: draw the plane at a fixed size and scale the plane (tan(atan2(100cqw, width)) gives the ratio as a number).
  7. A panel shown with display: none pays its first paint when it appears (100–300 ms for a busy one, once).
  8. <details name> keeps one section open in Chrome/Edge 120+, Safari 17.2+ and Firefox 130+; older browsers ignore the name and open each section on its own.
  9. Give an accordion’s sections a name of their own: every <details> on the page with the same name is one group, wherever it is.
  10. Closing the open section above shifts the one you just opened up the page, and on a long panel it can leave the view.
  11. In a panel under 300 px, a summary’s note beside its title squeezes both: the title wraps and the note is cut short. accordion({ narrow: 'auto' }) puts the note on its own row under the title and shrinks the body’s indent while the accordion is under 300 px wide (narrow: true always). 'auto' makes the root an inline-size container, so its width must come from its parent, never from its content (a shrink-to-fit parent collapses it).
  12. Animating ::details-content to auto needs interpolate-size: allow-keywords on an ancestor (the accordion’s root sets it), and content-visibility … allow-discrete in the transition, or the content vanishes at once on close instead of folding.
  13. In Reflow, a frame you dragged keeps that size as an inline style; the presets outrank it with !important and Free hands it back.
18 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.

WAI-ARIA Authoring Practices Guide (W3C): The radio group pattern: every switch here is a native radio group (one Tab stop, arrows move and select), honestly announced as radios rather than ARIA tabs.

David Douglas & Thomas Peucker, Algorithms for the reduction of the number of points required to represent a digitized line (1973): The contour and line simplification in geometry.ts.

Marching squares, the 2D case of William Lorensen & Harvey Cline’s marching cubes (1987): The terrace contours in geometry.ts.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (2020): Their PCG hash for the island’s value noise (terrain.ts).

WAI-ARIA Authoring Practices Guide (W3C): The accordion pattern, met by native <details> and <summary> (a button that says whether it is expanded) rather than ARIA.

Jane Ori, CSS type casting with tan(atan2()): The trick of dividing two lengths into a plain number, which scales the fixed-pixel planes to their boxes.

cssno javascript:has()anchor positioningscroll-driven animationsscroll timeline@propertycss countersoffset-pathmotion pathcontainer queriescss 3dclip-pathtabsaccordiondetailsdisclosuresortingfilteringthemesprogressive enhancementkeyboardaccessibilitydom

Near it in the frame