psychopy.org | Reference | Downloads | Github

Prevent reappearing mouse cursor

URL of experiment: aim [PsychoPy]

Use condition = 100 for a practice version.

Description of the problem: During the actual experiment the cursor I present is at a position rotated around [0,0] by 30 degrees. People adapt their movements, but this only makes sense if they can’t see the mouse cursors. I’ve found that when people switch between their browser and other software (or even just click the windows button and go back to the psychojs task), the cursor that was previously made invisible has reappeared again.

Adding some JS before each trial to hide the cursor (again) doesn’t seem to work (using PsychoJS method or core JS), but sometimes going to a different browser tab or other software and back actually does make the cursor disappear again.

This made me think that maybe window.focus() would help, but it doesn’t.

So far, this happens in Chrome and Edge, but not Firefox (Windows 10).

Is there some way to force a reappearing cursor to be invisible again?

I couldn’t reproduce your problem, but I do have an idea. Presently, you’re hiding the cursor via…
document.documentElement.style.cursor = 'none';
What I wonder is: if the cursor reappears, does the style change as well? If so, you could check on that and hide it again.

Hi Thomas,

Thanks for checking!

What I meant with “core JS” is that I added that line to the start of every trial, but it didn’t work…

I checked it some more, and printed the current cursor style on each frame (of the second part of the trial), and recorded my screen. At the start everything is as it should be. Then I open some other software and the cursor reappears… the style is still ‘none’ though:
https://youtu.be/KBb4EKV9e0Q

Ah well, I’m going to assume this is rare, and I added a question to the questionnaire that the task is embedded in, asking if people saw the cursor reappear.

Best,
Marius

My best bet would be some weird security measure by the browser. Can’t test it on scale I:m afraid; our automated systems don’t show cursors in screenshots.

Anyways, good luck with your study!