Skip to content

Fix: context menu items fire nothing on click - #24

Merged
codemastervy merged 1 commit into
mainfrom
fix-context-menu-inert-click
Sep 1, 2026
Merged

codemastervy merged 1 commit into
mainfrom
fix-context-menu-inert-click

Conversation

@codemastervy

Copy link
Copy Markdown
Owner

Same bug and root cause as nas-dashboard#31 -- this repo has an identical copy of the ContextMenu component. The outside-click dismiss listener ran in the capture phase on document, closing the menu (and unmounting it) before a click on the menu's own buttons ever fired. stopPropagation() on the container couldn't help, since that's a bubble-phase handler and capture had already run.

Fixed by checking click containment in the capture handler itself.

Verified with a real Puppeteer mouse-click sequence: the server-list context menu is testable without a live SMB connection -- right-click a saved server, click Edit Connection, confirm the dialog now opens (it didn't before). Outside-click dismissal still works (no regression).

Same root cause as nas-dashboard#31, in the identical copy of this
component: the outside-click dismiss listener ran in the capture phase
on document, which fires before the event reaches (or bubbles back out
of) any descendant -- including the menu's own buttons. It closed the
menu on every mousedown inside it too, unmounting the component before
a button's click ever fired. The container's onMouseDown{stopPropagation}
couldn't prevent this: propagation only affects listeners still pending
in the dispatch order, and the document-level capture listener had
already run before a bubble-phase handler further down the tree got a
turn.

Fixed by checking containment in the capture handler itself.

Verified with a real Puppeteer mouse-click sequence against a locally
built copy: the server-list context menu (Connect / Edit Connection /
Remove) is testable without a live SMB connection -- right-click a saved
server, click 'Edit Connection': before the fix, nothing happens; after,
the dialog opens. Confirmed clicking outside the menu still dismisses it
correctly (no regression). Backend's 56 tests unaffected, as expected
for a frontend-only fix.
@codemastervy
codemastervy merged commit 3ea7d79 into main Sep 1, 2026
3 checks passed
@codemastervy
codemastervy deleted the fix-context-menu-inert-click branch September 1, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant