SQRCAT
SQRCAT

Reputation: 5840

Use javascript to prevent context menu on CTRL+Leftclick

I am trying to allow my CMS users to click certain controls with ALT+CTRL both pressed, but this results in the context menu being shown, because CTRL+Leftclick simulates a Rightclick, at least here on Mac OSX (which is the primary OS of my client).

The question is: how can I stop the context menu from popping up but still make sure my click goes through to the element it is being triggered on?

I tried oncontextmenu="return false;" in my <body> for testing purposes. It would properly prevent the menu from popping up, but my click event would not go through.

Upvotes: 3

Views: 850

Answers (1)

SQRCAT
SQRCAT

Reputation: 5840

As i was unable to properly solve this problem by fiddling around with the way the browser behaves in regard to the context menu, i went for a different approach and bound the META key instead of the CTRL key. Works well this way. I'll leave the q/a in for others.

Upvotes: 1

Related Questions