3

In Opera, while you are holding down right click, no key events register.

window.onkeydown = function() {
    alert("hey");
}

this doesn't register if you're holding down the right mouse button in Opera.

I've disabled the context menu, but the right click still blocks key events.
I've also tried disabling mouse gestures in Opera (which use the right mouse button). There's no context menu nor mouse gestures, but key events still don't register while the right mouse button is down.

Here's a js fiddle example.
When you press any key, the "a" will move to the right, regardless of whether the right mouse button is down, unless you're in Opera.

Are there any workarounds/fixes?

Overcode
  • 4,074
  • 1
  • 21
  • 24
  • As far as I know, Opera has settings to disable certain JS functionality. Check your settings. – Joseph May 13 '13 at 04:40
  • You could try disabling mouse gestures... and ensure you've allowed your script to receive right-clicks (Preferences > Advanced > Content > JavaScript Options > "Allow scripts to detect context menu events"). – Amos M. Carpenter May 13 '13 at 10:32
  • That's on by default. Opera registers the right click, it just doesn't register any key events while right click is down. And yes I've disabled mouse gestures. – Overcode May 14 '13 at 02:36

1 Answers1

-1

It is onmousedown which will work for holding down right click below code works for me in opera and chrome for right click.

<html>
<body>
<script>
window.onkeydown = function() {
    alert("hey");
}
window.mousedown = function() {
    alert("hey mouse down");
}
</script>
</body>
</html>
Shebin Mathew
  • 320
  • 1
  • 7
  • 18
  • That wasn't my question, I know how to register right click events, I just need key events to register as right click events register. – Overcode May 29 '13 at 03:39