StealThis .dev

Long-press Context Menu

Open an action menu after a hold, canceling cleanly when the pointer moves away.

Open in Lab
html css javascript react
Targets: TS JS HTML React

Code

Long-press Context Menu

Open an action menu after a hold, canceling cleanly when the pointer moves away.

Support notes

The examples use Pointer Events, capture, bounded transforms, and small snap thresholds. Production code should also wire keyboard alternatives and reduced-motion preferences.

Included demo

  • Vanilla HTML, CSS, and JavaScript with zero external dependencies.
  • React equivalent using the same interaction model.
  • A Lab route for trying the behavior in isolation.

Integration checklist

Keep state updates separate from presentation, preserve semantic labels, and add persistence or server callbacks at the boundary where your product needs them.