fix: prevent default browser context menu from appearing on edge righ… #363
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.
…t-click
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When right-clicking on an edge, the custom context menu appears but the default browser context menu also shows up, causing UI overlap and unintended behavior.
Issue Number: 346
What is the new behavior?
Right-clicking on an edge now only opens the custom context menu.
The default browser context menu is suppressed using preventDefault() in the onContextMenu handler, and event propagation is stopped to prevent interference from other scene elements.
Does this PR introduce a breaking change?
Other information
onPointerDown fires before contextmenu, but the browser doesn’t care unless you also stop the contextmenu event.
onContextMenu directly intercepts the event that causes the browser menu.
event.preventDefault() removes the default menu, and event.stopPropagation() keeps it from triggering higher-level handlers.