Reply To: Trials start at the very end of the page

PennController for IBEX Forums Support Trials start at the very end of the page Reply To: Trials start at the very end of the page

#8667
Jeremy
Keymaster

Hi,

When you print a TextInput element, PennController gives it focus by default, so that the participant can start typing right away. The most recently printed TextInput element will take focus, and if an element has focus outside the current viewport, browsers usually automatically scroll down to make it visible

One workaround is to wait a few ms after printing the last TextInput element, at which point the browser will have scrolled down, and tell it to scroll back up:

    newTextInput("123aaa", "")
        .print()
        .log()
    ,
    newTimer(20).start().wait() // wait for focus to take effect
    ,
    newFunction( ()=>window.scrollTo(0,0) ).call()  // then scroll all the way back up

Jeremy