79596018

Date: 2025-04-28 08:12:51
Score: 1
Natty:
Report link

In my case of form-wide keydown-EventHandler set, I need to dispatch the Enter-Event manually:

const enterEvent = new KeyboardEvent('keydown', {
    key: 'Enter',
    keyCode: 8,
    which: 8,
    bubbles: true,
    cancelable: true
});

...

formElement.on("keydown", function(event){

    if (event.target.nodeName==="TEXTAREA" ){
        event.target.dispatchEvent(enterEvent);
        return true;
    }
});

);

Reasons:
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: null