Backspace key not working in online experiment

URL of experiment: PAS_24B_Prolific [PsychoPy]

Description of the problem:
Hi everyone, I’ve read the previous posts about the backspace key not working when the experiment is running online and still have not been able to solve my problem. I am running Psychopy v 2024.1.4. my experiment (code below) needs to collect typed keystrokes and their times. When running the experiment locally, all keys (including shift, spacebar… are recorded and show up on the screen). When running online, the only problem I have is with the backspace key, it is not recorded in the dataset and letters are not removed from the screen.

I tried an earlier suggestion of indexing backspace as ‘N/A’, but it did not seem to do the trick. I also tried using ‘delete’ instead of ‘backspace’.

Two quick notes about my code: First, I have experimental conditions so that some participants see the letter they typed on the screen, and some see “*”. Second, the javascript code is just what is automatically generated by PsychoPy.

thesekeys=event.getKeys()
n = len(thesekeys)
i = 0
frameNo = frameNo + 1

if frameNo < 5:
inputText = “”

while i < n:

#Hitting return ends trial
if thesekeys[i] == 'return':
    continueRoutine = False
    break 

#Hitting escape quits the experiment
elif thesekeys[i] == 'escape':
    core.quit()
    
#spacebar inserts blank space
elif thesekeys[i] == 'space':
    inputText += " "
    thisExp.addData("typingRT", typingclock.getTime())
    thisExp.addData("letterTyped", thesekeys[i])
    i+=1
    thisExp.nextEntry()
    
#shift raises "shift flag"    
elif thesekeys[i] == 'lshift' or thesekeys[i] == 'rshift' or thesekeys[i] == 'SHIFT':
    shiftFlag = True
    thisExp.addData("typingRT", typingclock.getTime())
    thisExp.addData("letterTyped", thesekeys[i])
    i+=1
    thisExp.nextEntry()

#Input the letter (capitalized or not)
else: 
    #handle the delete key, indexed as 'N/A'
    if thesekeys[i] == 'N/A':
        inputText = inputText[:-1]
        thisExp.addData("typingRT", typingclock.getTime())
        thisExp.addData("letterTyped", thesekeys[i])
        i+=1       
        thisExp.nextEntry()
    #Input and record capitalized letter
    else: 
        if shiftFlag == True and mask == 0:
            inputText += thesekeys[i].upper()
        elif shiftFlag == False and mask == 0:
            inputText += thesekeys[i]
        elif mask == 1:
            inputText += "*"
      
        thisExp.addData("typingRT", typingclock.getTime())
        thisExp.addData("letterTyped", thesekeys[i])
        shiftFlag = False

    i+=1
    thisExp.nextEntry()