Written response won't show on screen while typing

Hello everybody!

I am using PsychoPy 3 v2020.2.5 on Windows 10.

I am trying to create a text component where participants can type a response (a short paragraph).
I would like them to be able to see the text while they are typing it on the screen. Once they are finished, they should click the mouse to submit their response.

I have created a first text component, containing the phrase “Please type your answer below” that should be visible throughout the whole time the participant is typing. This works fine.

I have created a second text component that should contain the written response. It is accompanied by a code component, where I supposedly instruct psychopy to display the text and save the final answer. However, while I am typing I cannot see it on the screen and the sentences I type are not saved in the logfile.
I use the exact same structure in another routine and it works fine.

I would be very grateful if someone could point me to the place I am missing something!

All the best,

Begin Experiment

CommentaireLibre = "Decrivez comment vous avez fait "

Begin Routine

modify = False
text_Commentaire_Libre_Reponse.text = ""

Each Frame

keys = event.getKeys()
if len(keys):
    if 'space' in keys:
        text_Commentaire_Libre_Reponse.text = text_Commentaire_Libre_Reponse.text + ' '
    elif 'backspace' in keys:
        text_Commentaire_Libre_Reponse.text = text_Commentaire_Libre_Reponse.text[:-1]
    elif 'lshift' in keys or 'rshift' in keys:
        modify = True
    elif 'return' in keys:
        continueRoutine = False
        if modify:
            text_Commentaire_Libre_Reponse.text = text_Commentaire_Libre_Reponse.text + keys[0].upper()
            modify = False
            text_Commentaire_Libre_Reponse.text = text_Commentaire_Libre_Reponse.text + keys[0]

End Routine

thisExp.addData("text_Commentaire_Libre_Reponse.text", text_Commentaire_Libre_Reponse.text)