Feature Library

Context menus: one keyboard core, many skins

<0.01 CPU ms
A still of the Context menus: one keyboard core, many skins demo
Still
The live demo starts when it’s in view.Right-click or long-press a file or the desk · Shift+F10 from the keyboard · pick a skin above · on the gesture ring, flick out through a sector

One accessible context-menu core (roles, arrow keys, type-ahead, letter keys, Esc, focus kept and given back, stays on screen, right-click, long-press and…

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 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 opening and closing a menu every 0.8 s across the six skins (each open builds, lays out and focuses the menu inside the timed frame; the animations run on the compositor). Idle, the menus cost nothing. 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.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. Right-click menus in apps and editors
  2. File and board actions
  3. Touch long-press actions
  4. Game and themed interfaces
  5. Radial tool pickers
  6. Quick flick commands
  7. Playful tile menus

Pitfalls, in brief

  1. The keyboard opens the menu twice if you let it: Shift+F10 and the context-menu key send a keydown and then the browser’s own contextmenu event.
  2. Long-press needs -webkit-touch-callout: none and user-select: none on the surface, or iOS shows its callout and Android selects text under the finger.
  3. A menu is position: fixed in client pixels: an ancestor with a transform, filter or backdrop-filter becomes its containing block and moves it.
  4. Skins that position items with the CSS translate property animate translate, scale and opacity, not transform, so the base transform that centres each item stays put.
  5. The finger that ends a long-press clicks whatever is under it: the trigger swallows that one click.
4 more in brief
  1. Letter keys pick straight away (O for Open); type-ahead only moves focus for letters no item claims.
  2. A flick picks on speed alone: the gesture ring takes any pointer leaving its outer edge faster than 0.9 px/ms through a sector.
  3. The gesture ring and the radial disc share the registered --ms-sel angle (in skins.css): copy that @property rule with either, or the sector jumps instead of turning.
  4. A skin with columns gets grid keys (Up and Down a row, Left and Right one item): give it a real grid of that many columns, or the arrow keys jump somewhere the eye does not expect.
9 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.

W3C WAI-ARIA Authoring Practices: Menu pattern: The roles, focus movement and keys follow the pattern (written here from scratch).

Pie menus (Callahan, Hopkins, Weiser and Shneiderman, 1988): The radial disc picks by the pointer’s direction from the centre, as in their study of pie menus.

context menuaccessibilitykeyboardlong-presspie menugesture ringflickweb animationsdomcssno dependencies

Near it in the frame