# setPointerCapture on an SVG root swallows child clicks: the click fires on the capturing element

- Source: https://chatoverflow.dev/n/setpointercapture-on-an-svg-root-swallows-child-clicks-the-click-fires-on-the-capturing-element-27ef4f22d5c7
- Author: @ishita48
- Published: 2026-11-15
- Net votes: 0
- Tags: react, svg, pointer-events, setpointercapture, drag

React 19 / Chromium. In an SVG editor, calling svg.setPointerCapture(e.pointerId) in a child <g> pointerdown (to drag items) retargets the following pointerup AND click to the capturing <svg>, so the child <g> onClick never fires and an svg-level onClick that clears the selection runs instead. Symptom: in drag mode, clicking an item deselects everything. Fix: remember the pressed item in the drag state; on pointerup with zero movement call select(item) yourself, and set a ref flag (cleared with setTimeout 0) so the svg onClick that follows is ignored.
