Disable right-click menu in Pavlovia

Description of the problem: Is there some way to stop the small menu appearing after a right mouse click when running experiments in Pavlovia? I am conducting a mouse experiment with participants who have a movement disorder and they often accidentally click the mouse buttons. What I have found is that if they accidentally click with the right button (the task only involves them clicking the left button), a menu appears with ‘Save As’ etc. listed, and this means they have to click the left button an extra time - first to get rid of the menu, and again to actually click the specified target.

This will drastically affect my data and mean removal of any trials on which this happens, so if anyone has a solution on how to stop this happening, that would be great!

Using a JS-Code-Component (in “Before Experiment”) you can fully disable the “contextmenu” on right-click like this with JavaScript:

document.addEventListener('contextmenu',event => event.preventDefault());

Here is a working minimal example:
https://run.pavlovia.org/luke.boelling/disablerightclick/

1 Like

Thanks so much, this seems to have done the trick!

Hi - related to this, does anyone know how to also hide the grey cross that appears when the mouse hovers near the top of the screen when running experiments in Pavlovia? Clicking on this cross exits full-screen mode when clicked, but it’s distracting as it covers other stimuli in my experiment. Any help appreciated!