Cannot create any link: the ghost cable follows the cursor and swallows the click on the destination port #1

Closed
opened 2026-11-08 06:05:40 +00:00 by jaylouisw · 1 comment
Owner

Ported from GitHub Jaylouisw/packetforge#61, filed before Forgejo became the source of truth.

Summary

You cannot cabling a second port, because the ghost cable that follows your mouse sits on top of the socket you are aiming at and swallows the click.

The connecting state arms correctly, then clicking the destination port does nothing at all: no request is made, no media picker appears, no link is created, and the status bar drops silently from "Now click the destination port (Esc to cancel)" to "Ready". The connecting state stays armed, so the next click also does nothing.

Evidence

The ghost line is on top of the port

With port A armed, put the pointer on the destination port dot and ask the browser what is topmost there:

topmost AT CENTRE while ghost ends there: {'tag': 'line', 'cls': 'link-ghost'}
topmost 4px BELOW centre:                 {'tag': 'rect', 'cls': 'device-body'}

The circle.port is not the topmost element at its own centre — line.link-ghost is.

web/canvas.js:161-166 puts the ghost in the overlay layer, which is painted above world (#canvas > defs, g#world, g#packets, g#overlay):

ghostLine = el('line', { class: 'link-ghost', x1: a.x, y1: a.y, x2: a.x, y2: a.y }, overlay);

and web/style.css:157 never disables hit-testing on it:

.link-ghost { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 4; }

Computed style confirms: pointer-events: auto.

The click produces no traffic at all

With window.fetch instrumented (observation only), arming port A and then clicking the destination port dot produced zero network calls:

armed: {'deviceId': 'd2', 'iface': 'lan1'}
after clicking the destination dot: {'conn': {'deviceId':'d2','iface':'lan1'}, 'status': 'Ready'}
calls: []
links on canvas: 0

So PFCanvas.on.portClick (web/app.js:460) was never invoked — the click never reached the port. The status change to Ready is the background click path, not any of the connect-flow branches.

Why it is intermittent, and why it looks like "sometimes cabling works"

The ghost line's far end is the pointer position (canvas.js updates x2,y2 on pointermove). At the instant of mousedown the ghost therefore terminates exactly under the cursor — i.e. exactly on the socket you are clicking. Aim dead-centre and you hit the ghost every time. Aim a few pixels off and you may hit the circle.port, which is why this can appear to work occasionally. The socket is ~6 px across at zoom 0.6 and ~10 px at zoom 1, so the "off" window is a couple of pixels.

Reproduction

  1. Place any two devices with a compatible port pair (e.g. adtran/SDX611 lan1 and asus/RT-AX89X wan).
  2. Click the first port. Status: "Now click the destination port (Esc to cancel)". Confirmed armed.
  3. Move the mouse onto the destination port, then click it.
  4. Nothing happens. Status reverts to "Ready". No modal, no toast, no link.

Reproduced repeatedly, at zoom 0.6 and at zoom 0.88, on a topology with no other links.

Fix

pointer-events: none on the decorative overlay layer, at minimum on .link-ghost:

.link-ghost { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; }

Worth auditing the rest of the overlay in the same pass, because the same mistake is likely repeated:

  • .link-ghost — confirmed broken (this issue)
  • .packet (.packet { fill: var(--amber); filter: url(#glow); }) — animated packet dots sit above the world and will intercept clicks on anything they pass over
  • any label/text drawn into #overlay

The layer exists for things you must see but must never click. Setting pointer-events: none on #overlay itself is the one-line version, with pointer-events re-enabled on any genuinely interactive child.

Impact

This is the primary way to build a topology. Without it, cabling is a coin flip that depends on sub-pixel aim, and the failure is completely silent — no error, no toast, nothing in the console. It presents as "the app is broken and won't tell me why", and it is the most likely explanation for the earlier reports in this project that link creation "does nothing".

Notes

  • Found while rebuilding a whole home network through the UI. Nine devices placed fine; the first cable could not be made.
  • As a workaround for the rest of this test run I dispatch the destination mousePressed without a preceding mouseMoved, so the ghost's last position is not under the cursor. That is not something a person can do with a mouse — which is the point.
> Ported from GitHub `Jaylouisw/packetforge#61`, filed before Forgejo became the source of truth. ## Summary **You cannot cabling a second port, because the ghost cable that follows your mouse sits on top of the socket you are aiming at and swallows the click.** The connecting state arms correctly, then clicking the destination port does nothing at all: no request is made, no media picker appears, no link is created, and the status bar drops silently from *"Now click the destination port (Esc to cancel)"* to *"Ready"*. The connecting state stays armed, so the next click also does nothing. ## Evidence ### The ghost line is on top of the port With port A armed, put the pointer on the destination port dot and ask the browser what is topmost there: ``` topmost AT CENTRE while ghost ends there: {'tag': 'line', 'cls': 'link-ghost'} topmost 4px BELOW centre: {'tag': 'rect', 'cls': 'device-body'} ``` The `circle.port` is **not** the topmost element at its own centre — `line.link-ghost` is. `web/canvas.js:161-166` puts the ghost in the `overlay` layer, which is painted above `world` (`#canvas > defs, g#world, g#packets, g#overlay`): ```js ghostLine = el('line', { class: 'link-ghost', x1: a.x, y1: a.y, x2: a.x, y2: a.y }, overlay); ``` and `web/style.css:157` never disables hit-testing on it: ```css .link-ghost { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 4; } ``` Computed style confirms: **`pointer-events: auto`**. ### The click produces no traffic at all With `window.fetch` instrumented (observation only), arming port A and then clicking the destination port dot produced **zero** network calls: ``` armed: {'deviceId': 'd2', 'iface': 'lan1'} after clicking the destination dot: {'conn': {'deviceId':'d2','iface':'lan1'}, 'status': 'Ready'} calls: [] links on canvas: 0 ``` So `PFCanvas.on.portClick` (`web/app.js:460`) was never invoked — the click never reached the port. The status change to `Ready` is the *background* click path, not any of the connect-flow branches. ### Why it is intermittent, and why it looks like "sometimes cabling works" The ghost line's far end is **the pointer position** (`canvas.js` updates `x2,y2` on pointermove). At the instant of `mousedown` the ghost therefore terminates exactly under the cursor — i.e. exactly on the socket you are clicking. Aim dead-centre and you hit the ghost every time. Aim a few pixels off and you may hit the `circle.port`, which is why this can appear to work occasionally. The socket is ~6 px across at zoom 0.6 and ~10 px at zoom 1, so the "off" window is a couple of pixels. ## Reproduction 1. Place any two devices with a compatible port pair (e.g. `adtran/SDX611` `lan1` and `asus/RT-AX89X` `wan`). 2. Click the first port. Status: *"Now click the destination port (Esc to cancel)"*. Confirmed armed. 3. Move the mouse onto the destination port, then click it. 4. Nothing happens. Status reverts to *"Ready"*. No modal, no toast, no link. Reproduced repeatedly, at zoom 0.6 and at zoom 0.88, on a topology with no other links. ## Fix `pointer-events: none` on the decorative overlay layer, at minimum on `.link-ghost`: ```css .link-ghost { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; } ``` Worth auditing the rest of the overlay in the same pass, because the same mistake is likely repeated: - `.link-ghost` — confirmed broken (this issue) - `.packet` (`.packet { fill: var(--amber); filter: url(#glow); }`) — animated packet dots sit above the world and will intercept clicks on anything they pass over - any label/text drawn into `#overlay` The layer exists for things you must *see* but must never *click*. Setting `pointer-events: none` on `#overlay` itself is the one-line version, with `pointer-events` re-enabled on any genuinely interactive child. ## Impact This is the primary way to build a topology. Without it, cabling is a coin flip that depends on sub-pixel aim, and the failure is completely silent — no error, no toast, nothing in the console. It presents as "the app is broken and won't tell me why", and it is the most likely explanation for the earlier reports in this project that link creation "does nothing". ## Notes - Found while rebuilding a whole home network through the UI. Nine devices placed fine; the first cable could not be made. - As a workaround for the rest of this test run I dispatch the destination `mousePressed` **without a preceding `mouseMoved`**, so the ghost's last position is not under the cursor. That is not something a person can do with a mouse — which is the point.
Author
Owner

Fixed in web/canvas.js. The ghost cable is created with pointer-events: none and an explicit data-ghost="connecting" marker, and hitTest() has no case for it — so it can follow the cursor without ever becoming a shield in front of the socket you are aiming at.

The comment that guards it is in the source: "pointer-events is off here and in style.css, and hitTest() has no case for it". test/link-mode-ui.test.js (20 checks) covers the arm → select → complete path.

Closing because the code already does what the issue asks for. Reopen if you can still reproduce it — that would mean a specific browser or pointer-capture path, and it is worth knowing about.

Fixed in `web/canvas.js`. The ghost cable is created with `pointer-events: none` and an explicit `data-ghost="connecting"` marker, and `hitTest()` has no case for it — so it can follow the cursor without ever becoming a shield in front of the socket you are aiming at. The comment that guards it is in the source: *"pointer-events is off here and in style.css, and hitTest() has no case for it"*. `test/link-mode-ui.test.js` (20 checks) covers the arm → select → complete path. Closing because the code already does what the issue asks for. Reopen if you can still reproduce it — that would mean a specific browser or pointer-capture path, and it is worth knowing about.
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#1
No description provided.