progapandist / evil_chat

Code for "Evil Front: Modern Front-end in Rails" 3-part tutorial: https://evilmartians.com/chronicles/evil-front-part-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Evil Front Part 3]: input event listener comment (metaKey is not ctrl key)

installero opened this issue · comments

As the MDN web docs says metaKey is the Windows key.

  // You can send a message with cmd/ctrl+enter
  input.addEventListener("keydown", event => {
    if (event.keyCode === 13 && event.metaKey) {
      event.preventDefault();
      submitMessage(input);
    }
  });

Actually you I wasn't able to trigger this event in Firefox on Ubuntu.