Text component does not update color on every trial, working in psychopy but not in psychojs

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2020.2.2
Standard Standalone? (y/n) y
What are you trying to achieve?:
I built my experiment in Builder, and it works fine in psychopy but is not executing exaclty how I want it to when I run it on Pavlovia in psychojs. The behavior I am aiming to achieve is that on each trial when a participant presses the ‘f’ key, a text component on the screen will turn blue, indicating that it was the selected option, and then after a 1 second delay, the text component turns green if it is the correct answer or red if incorrect. And the same if the ‘j’ key is pressed for a different text component.

What did you try to make it work?:
I know my logic that I added through a code component is correct because it does this desired behavior when I run it in builder. When I run it on Pavlovia though, it changes the colors correctly for the first trial only, and then after it is stuck on the behavior from the first trial. I am also confident my logic in js is working too because the behavior of the “correct”/“incorrect” text feedback is correct on every trial, and it uses the same logic. In other words, the text of this written feedback text component is updating properly using the given logic, but the colors of the other text components are not updating properly.

Furthermore, I added console.log() calls inside the if/else block in the js code within builder to test the logic, and I can see that the statements are properly handling the key input and changing the variables holding the colors to the expected color name accordingly.

I’m wondering whether the setColor method call is broken and is not updating the color of the text. Specifically, if text is the text component and color is the color I want to change it to, I think where it says this text.setColor(new util.Color(color)) in the .js file is what is not working.

I’ve looked through the code many times and troubleshooted a lot of different pieces (including that the conversion from python to js was wrong), and I can’t find anything that would cause this not to work in js except that the setColor method isn’t working.

Any advice on someting I may have missed checking? Let me know if there is any more information I need to provide!

Dear @erl many thanks for flagging, please bear with us, a patch is on the way :blush: