Dropping a device under the floating #canvas-toolbar creates a device with no clickable point at all #33

Closed
opened 2026-11-08 06:09:02 +00:00 by jaylouisw · 0 comments
Owner

Summary

The floating #canvas-toolbar sits on top of the canvas and silently swallows any device dropped underneath it. The device is created and exists on the server, but it has no clickable point at all — it cannot be selected, dragged, renamed, cabled, or deleted with the mouse.

Reproduction

  1. Zoom/pan so that some part of the canvas is under the floating toolbar.
  2. Pick a device from the catalogue and click that covered part of the canvas.
  3. The device appears (server confirms it), and the status bar reports it as placed.
  4. Try to interact with it: every click lands on the toolbar instead.

Evidence

The device group is present and valid in the DOM, and is even programmatically selectable:

document.querySelector('#world > g[data-device-id="d22"]')   // -> <g> exists
// its screen rect: {x: 678, y: 520, w: 107, h: 32}

But hit-testing every pixel of its body returns the toolbar:

document.elementsFromPoint(730, 530)
// -> ["DIV#canvas-toolbar", "DIV#canvas", ...]

A full scan of the device body for a point where elementFromPoint(...).closest('[data-device-id]')
resolves to the device returns null — there is no such point. document.elementFromPoint at
the device's own centre returns DIV#canvas-toolbar.

There is no workaround inside the device itself: no z-order control, no bring-to-front, no
"send to back", no context menu (see the cable-deletion issue for why the context menu is empty).
The only recovery found was to pan the entire world upward until the device cleared the
toolbar — which moves every other device too, and only works because there happened to be free
canvas above.

Root cause (likely)

  • #canvas-toolbar is absolutely/fixed positioned over #canvas and does not set
    pointer-events: none on its container (only its buttons should take pointer events).
  • Placement uses the pointer position directly and does not check whether the drop point is
    occluded by the application's own chrome, nor does it clamp the drop into the visible,
    unobstructed
    canvas region.

Suggested fixes

  1. #canvas-toolbar { pointer-events: none; } with pointer-events: auto on its interactive
    children — the canvas underneath then stays clickable through the toolbar's padding.
  2. On placement, reject or offset a drop whose point is covered by app chrome, so a device can
    never be created in an unreachable position.
  3. More generally, keep placed devices within the unobstructed canvas area rather than anywhere
    inside the <svg> bounds.

Impact

A device can be created in a permanently unusable state, and the only escape is to move the whole
board. This is reachable by ordinary use — the toolbar overlays a real strip of canvas, so a user
zoomed in or working near the bottom of the board will hit it without doing anything unusual.

## Summary The floating `#canvas-toolbar` sits on top of the canvas and **silently swallows any device dropped underneath it**. The device is created and exists on the server, but it has **no clickable point at all** — it cannot be selected, dragged, renamed, cabled, or deleted with the mouse. ## Reproduction 1. Zoom/pan so that some part of the canvas is under the floating toolbar. 2. Pick a device from the catalogue and click that covered part of the canvas. 3. The device appears (server confirms it), and the status bar reports it as placed. 4. Try to interact with it: every click lands on the toolbar instead. ## Evidence The device group is present and valid in the DOM, and is even programmatically selectable: ```js document.querySelector('#world > g[data-device-id="d22"]') // -> <g> exists // its screen rect: {x: 678, y: 520, w: 107, h: 32} ``` But hit-testing every pixel of its body returns the toolbar: ```js document.elementsFromPoint(730, 530) // -> ["DIV#canvas-toolbar", "DIV#canvas", ...] ``` A full scan of the device body for a point where `elementFromPoint(...).closest('[data-device-id]')` resolves to the device returns **null** — there is no such point. `document.elementFromPoint` at the device's own centre returns `DIV#canvas-toolbar`. There is no workaround inside the device itself: no z-order control, no bring-to-front, no "send to back", no context menu (see the cable-deletion issue for why the context menu is empty). The only recovery found was to **pan the entire world upward** until the device cleared the toolbar — which moves every other device too, and only works because there happened to be free canvas above. ## Root cause (likely) - `#canvas-toolbar` is absolutely/fixed positioned over `#canvas` and does not set `pointer-events: none` on its container (only its buttons should take pointer events). - Placement uses the pointer position directly and does not check whether the drop point is occluded by the application's own chrome, nor does it clamp the drop into the *visible, unobstructed* canvas region. ## Suggested fixes 1. `#canvas-toolbar { pointer-events: none; }` with `pointer-events: auto` on its interactive children — the canvas underneath then stays clickable through the toolbar's padding. 2. On placement, reject or offset a drop whose point is covered by app chrome, so a device can never be created in an unreachable position. 3. More generally, keep placed devices within the unobstructed canvas area rather than anywhere inside the `<svg>` bounds. ## Impact A device can be created in a permanently unusable state, and the only escape is to move the whole board. This is reachable by ordinary use — the toolbar overlays a real strip of canvas, so a user zoomed in or working near the bottom of the board will hit it without doing anything unusual.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#33
No description provided.