URL of experiment: Eva Specht / TextBox no autofocus online · GitLab
Description of the problem:
In my experiment I use the editable TexBox (Beta) component to collect answers.
Offline, the text box gets auto-focus so that the test subjects don’t have to keep manually clicking in the box before typing in the answer.
Online, however, the text box does not get auto-focus. In each trial, the box must be manually clicked with the mouse before the answer can be typed and ‘Enter’ can be pressed to move on to the next trial.
Is this a bug in PsychoJS and does anyone have a solution to this problem?
I am using Builder, PsychoPy v2020.2.10 on macOS Catalina 10.15.7.
Thanks for helping!
You need the following line of code in a JS code component in the each frame tab to bring the textbox to focus online:
Hope this helps,
Ps. We are looking to make the behaviour of the textbox online equivalent to the local textbox in this regard!
Had the same error, this fixed it for me. Thank you, Becca!
Thanks, Becca, that solved the issue!
Happy to help! I hope you don’t mind I marked the solution here for future users
All the best!
I am facing the same problem and tried applying this solution as shown below.
But unfortunately, once uploaded to Pavlovia and run, when the experiment got that point it threw this error.
Is there anything else I have to do to make this work - like include some special library or something? Is that term
_pixi part of the standard Python tools?
Thanks for any help - I really need to get this working.
Hi Dan - I think now you should just be able to add a code component with this in the “begin routine” tab
textbox.refresh() hope that helps
(apologies for the caps - but this problem has been kicking my butt for AGES now…)
Some more details - I figured out that the error I saw above was caused by my code being higher up in the list than the Textbox to which it referred. Also - I had to remove all the attempts at the _pixi approach for the ‘textbox.refresh’ thingo to work. BUT…
It now does.
Thank you SO MUCH @Becca and @wakecarter.
Very happy right now.
Oh. No. Wait.
This approach works on-line. But… when I try and run it locally now - PyschoPy throws an error.
Is this expected? Any ideas?
(Error message in the Runner window above)
What if you change that code component to Both and then delete the Python side?
Ah. Yes. And THIS seems to work.
And that’s an elegant little solution to an ugly problem.
Also has made more cognisant of what the two panels of the code window can be used for.