Changing an SVG <use> href on mousedown swallows the click event

#388097688 Filed 2025-01-07 P4 / S4 New

Repro

Click the black inner shape a few times, keeping the pointer near the center. The black shape is the <use>; the gray padding around it is a plain <rect>.

The mousedown handler sets href="#pressed", the click handler sets it back to #idle. Unpatched Chrome counts every mousedown but no click, so the shape stays stuck on the pressed variant.

mousedown 0   click 0
click the shape

Expected vs actual

Expected: every press/release pair over the <use> dispatches a click targeting the <use>, so the counters stay in sync.

Actual (Chrome ≤ 148): mousedown 3 / click 0. The focus half of the original report no longer reproduces -- that one was fixed by BoundaryEventDispatchTracksNodeRemoval.

Workaround

Put pointer-events: none on the <svg> so hit testing lands on the host element instead of the instance tree.

Links

Issue 388097688 Original reporter page