Repository navigation
Fix: context menu items fire nothing on click - #24
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).