Skip to content

Web: fix right-click context menu#1704

Merged
ruevs merged 1 commit intosolvespace:masterfrom
phcreery:right_click
Mar 31, 2026
Merged

Web: fix right-click context menu#1704
ruevs merged 1 commit intosolvespace:masterfrom
phcreery:right_click

Conversation

@phcreery
Copy link
Copy Markdown
Contributor

@phcreery phcreery commented Mar 31, 2026

disable right-click on context menu ul element creation.
The element gets created on keydown, and then the browser sees a right click on that new element upon keyup.

Another way to go about this is something like this:

const observer = new MutationObserver((mutations) => {
  for (const mutation of mutations) {
    mutation.addedNodes.forEach(node => {
      if (node.nodeType === 1) { // Check if it's an element
        if (node.matches('ul.menu.popup')) {
          node.setAttribute('oncontextmenu', 'return false');
        }
        // Also check if the added node contains the target element
        const nested = node.querySelector('ul.menu.popup');
        if (nested) nested.setAttribute('oncontextmenu', 'return false');
      }
    });
  }
});

observer.observe(document.body, { childList: true, subtree: true });

but the approach I took here seemed much nicer.

@phcreery phcreery changed the title fix right-click contect menu fix right-click context menu Mar 31, 2026
@phcreery phcreery marked this pull request as draft March 31, 2026 14:31
@ruevs ruevs changed the title fix right-click context menu Web: fix right-click context menu Mar 31, 2026
@ruevs ruevs marked this pull request as ready for review March 31, 2026 17:55
@ruevs
Copy link
Copy Markdown
Member

ruevs commented Mar 31, 2026

@phcreery welcome to SolveSpace and thank you for the contribution.
I'm glad the live web version is attracting attention :-)
It works (I checked locally) so I'll merge this. The live version should update after two hours.

P.S. I saw your raw tool - you should check out RawTherapee (also here) ;-)

@ruevs ruevs merged commit 3e5873e into solvespace:master Mar 31, 2026
4 checks passed
@ruevs ruevs added the Web The emscripten based web version of SolveSpace label Mar 31, 2026
@phcreery
Copy link
Copy Markdown
Contributor Author

phcreery commented Apr 1, 2026

Thanks! The web version is great!

Also, thanks! I have abandoned that raw editor project and have restarted it from scratch. Thanks for the rec., I will give it a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Web The emscripten based web version of SolveSpace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants