TypeError: Cannot read property 'getBoundingClientRect' of null

Description of the problem: Cannot type anything in the text box on Pavlovia but works perfectly fine in desktop

Error message: TypeError: Cannot read property ‘getBoundingClientRect’ of null

As mentioned above, I can’t type anything in the text box when running the pilot experiment. This error message is not seen in other threads and I would like to seek help from the experts here. Below are the links to the experiment:

URL of experiment: https://run.pavlovia.org/khpy6ckh/4th-study-demo
Codes of experiment: https://gitlab.pavlovia.org/khpy6ckh/4th-study-demo

Appreciate anyone’s opinion on this. Thanks in advance!

Regards,
Kai

Hey @khpy6ckh,

I’m an expert :wink: could you share your repo with me? (tpronk)

1 Like

Hi @thomas_pronk, just did. Do let me know if you need anything else. :grin:

Hey again!

I know what causes the problem, but I’m afraid we don’t yet have a solution yet: textbox doesn’t work after (or in combination with) a keyboard response. The best workaround I can offer at the moment is using mouse responses instead.

It’s a known issue though; made a ticket for it over here: Textbox doesn't register input after a keyboard response · Issue #287 · psychopy/psychojs · GitHub

Sorry for not being able to be of more help.

1 Like

Hi @thomas_pronk
No, please don’t be sorry. That actually solves my problem :smiley: (since what I want is just a simple transcription task where participants can proceed after typing what they hear).
Thanks again, senpai!

Happy to read that. Good luck with your experiment!

Hi @thomas_pronk, mind if I ask you one last question?

I finish designing the experiment and everything seems to work well, except the part where I can hear the audio playing more than what it is supposed to play in the second routine onwards (e.g. instead of “the boy is running”, the audio is played as “the boy is running, the”). The additional word here “the” might be from the next sentence in the stimuli excel list. It works perfectly fine in the first routine.

Problem: Audio playing more than it should in the second routine onwards.

Suspected problems and effort to solve this:

  1. Error message: I get the same error message “TypeError: Cannot read property ‘getBoundingClientRect’ of null” from Pavlovia and I am not sure whether it is because textbox doesn’t work after a mouse response too? I have tried to use different options (e.g. button) but then the experiment could not run at all.

  2. Stimuli: I have checked the stimuli (e.g. audio recordings) and they seem to stop perfectly fine after finishing a sentence (e.g. stopping right after “the boy is running”). To be safe, I tried to further shorten the audio, thinking it might be due to unclean trimming, but the problem still persists. I also try to set the duration for the stimuli (e.g. setting them to end after 3s) but this is to no avail.

  3. Differences between first and other routines: I only change the location to detect the stimuli for other routines. The differences include the stimuli excel file, stimuli and filepath. So far, I don’t find anything odd between the differences.

  4. Other troubleshooting threads: I don’t see any thread that addresses why audio are played longer than they should, but mostly about why the audio are cut short: Audio stimuli being cut short in trials. I have some suspects regarding the difference in duration which might lead to the problem, but again when this is addressed as suggested in the thread, the problem still persists. The duration of my stimuli are all around 1-2s.

Sorry for troubling you again.
p/s I have shared my repo with you, do let me know if you need more information. You could also refer me to any similar thread so I can try to solve the issue on my own.

Thank you.

Regards,
Kai

No prob. Could you tell me the name of your repo?

Hi @thomas_pronk , it’s called “4th study demo”.

Hey again!

I managed to reproduce the issue, but I also found a workaround: the “final the” in the 2nd routine onwards does not happen if you convert the samples from WAV to MP3. Now, this is generally a good a idea to do, because MP3 is more widely supported on browsers. See this tutorial for an easy way to convert your stimuli: Media formats suitable for online studies — PsychoPy v2021.1

Also, could I use your experiment to file a bug report? If that’s OK, I’d need to make a public version, but I’d only include the first two routine, reducing conditions and stimuli to only have ENG_A_1.wav and ENG_B_1.wav; that’s enough to demonstrate the bug.

Cheers, Thomas

Hi @thomas_pronk, I have converted all stimuli to mp3 and try to run it again on Pavlovia, but the problem is still not solved.

p/s Previously I had tried to use mp3 format according to one of my colleagues’ suggestion, but then the experiment did not even run using the offline psychopy. The error message showed “RuntimeError: Error opening ‘stimuli/ENG_A_14.mp3’: File contains data in an unknown format.” This is why I change to wav format based on the advice from the discourse forum.

*And yes, you could use my experiment to file a bug report.

Regards,
Kai

Thanks! Let me share my version of your experiment, then you can see what test I ran.

Hi @thomas_pronk, I think I have managed to resolve the issue. It seems that when I convert the audio to MP3, there will be more sound behind which was initially not noticed from WAV (it’s like the unclean trimming is shown in MP3 but not in WAV!). Now I just have to trim the MP3 audio again, and the audio will work like what I intended (it works now for my second routine).

Thank you for helping!

1 Like

Happy you’re back on track!