fkhadra / react-contexify

👌 Add a context menu to your react app with ease

Home Page:https://fkhadra.github.io/react-contexify/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

JoeGaffney opened this issue · comments

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.

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(),
      });
    }
  }