Mouse right click makes isPressedIn function work on hover

URL of experiment: /

Description of the problem: If the right button on my mouse is pressed anywhere on the screen, function mouse.isPressedIn() doesn’t work like it’s supposed to - I can just hover over the object and Pavlovia registers it as a click after the right click has been made. I tried adding (Py) buttons=[0] / (Js) {"buttons": [0]} as a parameter, but it doesn’t do anything. I tried adding mouse.clickReset(), nothing happens. Would very much appreciate any tips!


I’m not 100% sure what you’re after. When testing a bit, I noticed the following:

  1. When I right-click and make a context menu appear, none of the clicks get registered until I right-click again and so make the context menu disappear again.
  2. When I right-click, keep the mouse button down, and drag the mouse into a component, the “isPressedIn” does get fired.

Is your question related to #1? As in, you’d like to register clicks while a context-menu is visible?

Best, Thomas

Thank you for your reply. It’s similar to your second point - instead triggering the function with a click, “isPressedIn” is triggered only by the mouse hovering over it and that is not what I want.
My understanding is that this function should be triggered only when a click is made while the cursor is inside of the object, and with this error, you don’t need to click anymore, just hover. Thanks!

Thanks for clearing up! We actually changed it such that “click and drag inside a stimulus” does trigger isPressedIn, to have PsychoJS act like PsychoPy does. I’d need to think a moment to find out how to have it behave as you want.


during the final testing of my experiment I ran into the same problem.
I have black circles, which are supposed to turn yellow on the first click and blue when the mouse gets pressed for the second time. (if len(mouse.clicked_name ==2)…)
Whenever I click on a stimulus and wait some time, everything works as it is supposed to.

However, if I click on a stimulus, release the mouse and quickly move to another stimulus all circles start turning yellow if I only hover over them.
Is there a way to specify that actions mousePressedIn should only work for a mouse press?



I fixed it using "mouse.clicked_name== " instead go PressedIn. :slight_smile:

1 Like