Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to disable the custom context menu for a tag #257

Open
JoeGaffney opened this issue Nov 7, 2023 · 1 comment
Open

Is there a way to disable the custom context menu for a tag #257

JoeGaffney opened this issue Nov 7, 2023 · 1 comment

Comments

@JoeGaffney
Copy link

JoeGaffney commented Nov 7, 2023

Is there a way to disable the context menu on img tag?

For example inside a component that has a custom context menu there is some img tags that we want the default browser context menu.

@JoeGaffney JoeGaffney changed the title Is there a way to disable the custom the context menu for a tag Is there a way to disable the custom context menu for a tag Nov 7, 2023
@JoeGaffney
Copy link
Author

JoeGaffney commented Nov 7, 2023

Found out how you can do it on the showMenu function if anyone stumbles upon this query

function showMenu(e) {
    // Prevent the context menu from appearing for certain elements
    if (e.target.tagName === "IMG" || e.target.tagName === "VIDEO" || e.target.tagName === "A") {
      return;
    } else {
      e.stopPropagation();
      show({
        event: e,
        props: {},
        id: GetMenuId(),
      });
    }
  }

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

No branches or pull requests

1 participant