Textbox skips immediately after first key press-updated

URL of experiment: Pavlovia

Version: 2021.2.3
Browser: Google Chrome
OS: Win 10

Description of the problem: Hi, I am running an experiment where participants are asked to estimate a target numerosity. I demonstrate a dot array and ask participants to enter their estimation in numbers on a textbox and click to a text to save their estimations. Works fine in local, however, when I try to type an estimation on the textbox, it only receives my first button response (and not the second) and skips immediately without waiting for me to click on “save” text to save my estimation. For example, if i were to type “12”, it accepts only “1” and skip immediately without letting me enter the second digit.

does anybody know a solution for this issue? thanks, tutku

How is your routine set to end? It it automatically ends on the second digit I would recommend preventing that to see whether a key press of 1 is being registered as 11, and whether the second 1 appears when the key is released.

If you have a keyboard component, have you unticked “Force end of routine”?

Hi @wakecarter, thank you so much for your reply. My routine is set to end to a valid click on a mouse component. In local, a second keyboard button press doesnt end the routine, but in online, the first button press ends the routine (i cant see what I’ve pressed on the textbox by the way) and in the second iteration, it does not allow me to edit the textbox.

I dont have a keyboard component. To end the routine, I use mouse component.

That sounds like you have an error which occurs when a key is pressed. Does the rest of the experiment work okay, or does it crash at that point?

@wakecarter, as it crashes at this point (which is quite the beginning of the experiment), I couldnt test the experiment as a whole unfortunately. but as I said, the whole experiment works perfectly in local.

You need to look at the error message in the Browser console.

What code is there related to the key press?

Your initial message implied that the experiment continued rather than crashing.

@wakecarter the browser does not give any errors in the console unfortunately.

Please could you add a credit or two and set it to running so I can try?

https://psychopy.org/online/psychoJSCodingDebugging.html

@wakecarter , thank you so much for all your effort. I set my experiment to running, here is the link:

https://run.pavlovia.org/oztel/bayesianestimation

I think that the issue is related to this code:

 mouse_buttons = baseline_estSkip.getPressed();
 if ((mouse_buttons !== [0, 0, 0])) {
     baseline_estResponse.text = baseline_estResponse.text.slice(0);
     continueRoutine = checkEmpty(baseline_estResponse.text);
     psychoJS.eventManager.clearEvents("keyboard");
 }

It seems to be going into an infinite loop.

What does this code look like in your code component (in Python)? It it being auto translated?

What does the code to define checkEmpty look like?

Try removing this code and advancing on a simple mouse component click to see if you can narrow down the issue.

thank you so much for your suggestion @wakecarter . removing the part that you highlighted seems to solve the problem.