react-contexify
react-contexify copied to clipboard
Is there a way to disable the custom context menu for a tag
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(),
});
}
}