Prevent enter from going to the next tab focus

Is there a way to keep the focus in the same text input after pressing enter?

I have a few form items in a dialog and when press the enter key the focus moves into another form item.

Actually they are not in a form.

Never mind I got it. In my change handler I added a call to focus():

 myInput.addEventListener("change", myInputHandler);
 myInput.addEventListener("input", myInputHandler);

 myInputHandler(e) {
    // do something 

    if (e.type=="change") {
      myInput.focus(); // return focus
    }
 }
1 Like

Thanks for posting the answer @Velara!