Dock button clicks dead: real mouse / playwright clicks don't trigger handler, only JS .click() works #79
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_os#79
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Repro on current development, WASM built fresh (
unset RUSTC_WRAPPER+dx clean+dx build --package hero_os_app --web --features web --no-default-features).Symptom: clicking any dock archipelago button (Projects, Communication, ...) in a real browser does nothing — popup never opens. Confirmed via Playwright with four click strategies:
locator.click()on buttonlocator.click({force:true})on.dock-icon-boxdblclickpage.evaluate(btn => btn.click())Only direct
HTMLElement.click()JS invocation triggers the handler. Real mouse events (simulated via CDP or native) do not.data-dioxus-idis present on the<button>, so event delegation should work.Ruled out:
<script>tags from servedindex.html— bug persists)dx clean+ full rebuild — bug persists)pointer-eventsCSS (.dock-btn, .dock-icon-box all have default pointer-events: auto)Impact: full dock unusable. Users can't open any archipelago. Workaround in tests: dispatch
hero:open-islandCustomEvent directly.Found the root cause. Same repro as the original report.
Where: crates/hero_os_app/src/main.rs:1314-1319, installed by PR #76 (dock overflow scroll + drag affordance).
The dock-scroll JS calls
el.setPointerCapture(e.pointerId)on everypointerdown:Per the W3C Pointer Events spec, once a pointer is captured on
.dock-sections-scroll, the resultingclickevent'stargetis the capture element — not the.dock-btnchild. Dioxus's event delegation keys ondata-dioxus-idwalked fromevent.target, so the click bubbles out of the scroll container with no ancestor carrying the button handler, and the popup never opens.This is why
HTMLElement.click()worked in the earlier probe: it synthesizes a click directly on the button, bypassing pointer capture. Real mouse / Playwright clicks go through the capture path and land on the wrong target.Minimal fix: arm
setPointerCaptureonly when drag is actually confirmed. Move it intopointermoveguarded by a small movement threshold (e.g.Math.hypot(dx, dy) > 3), and drop it frompointerdown. That preserves drag-to-scroll while leaving plain clicks alone.Fix verified in a local rebuild. Moving
setPointerCaptureout ofpointerdownand intopointermovebehind a 3px threshold restores the click path.Playwright probe, same page as the original repro:
Real mouse clicks on
.dock-btnnow route through Dioxus event delegation as before, and drag-to-scroll still works (capture is armed only once the pointer has moved past the threshold).