Skip to content
Back to skills

Ztx14 Curated Pointer Capture Drag

ASecurity

Implement drag and gesture interactions that survive leaving the target, handle cancellation, and share behavior across mouse, pen and touch.

  • 14 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmentapi

Works with

  • api

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add Realjustawall/Perfect-AI --skill ztx14-curated-pointer-capture-drag --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ztx14 Curated Pointer Capture Drag?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ztx14 Curated Pointer Capture Drag
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/realjustawall-ztx14-curated-pointer-capture-drag/badge)](https://www.skillsdirectory.com/skills/realjustawall-ztx14-curated-pointer-capture-drag)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ztx14-curated-pointer-capture-drag
description: Implement drag and gesture interactions that survive leaving the target, handle cancellation, and share behavior across mouse, pen and touch.
---

# Robust drag interactions with Pointer Capture

> Curated implementation skill. Inspect the installed project and actual component source before changing behavior. Do not assume latest APIs are installed. Preserve unrelated files and existing component ownership.

## Standard state model
`idle → pressed → dragging → committed | cancelled → idle`.
Keep the active `pointerId` and drag origin explicitly; reject stray pointers unless multi-pointer behavior is intentionally supported.

## Implementation rules
1. On `pointerdown`, validate the button/target, record origin and active pointer id, then use `setPointerCapture(pointerId)` when the interaction needs continued events outside the hit target.
2. Process `pointermove` from the captured pointer only; normalize coordinates against the correct root and clamp where the world has bounds.
3. On `pointerup`, commit only if the drop/threshold rules pass. On `pointercancel` or lost capture, restore or cancel predictably.
4. Release capture when appropriate, and reset state when the component unmounts or route changes.
5. Treat `touch-action` as a deliberate product choice: do not disable page scrolling over large areas without a clear reason.
6. Provide keyboard and tap alternatives for essential drag actions.

## Tests
Simulate movement outside bounds, cancellation, touch interruption, wrong pointer id, rapid down/up, resize during drag, and dropped targets that unmount.

## Primary references
- [pointer-events](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events)
- [mdn-pointer-capture](https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture)
- [wcag22](https://www.w3.org/TR/WCAG22/)

## Completion evidence
- State what was inspected, what changed, and which checks actually ran. Never report unrun tests or unverified browser behavior as passing.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.