JSFiddle - React, Tailwind, and code Playground

HTML

<html>
  <body>
    <div>
      <form>
        <label>X:</label><input type="text"/>
        <label>Y:</label><input type="text"/>
        <label>Z:</label><input type="text"/>
      </form>
    </div>
  </body>
</html>

JavaScript

document.onkeydown = function (evt) {
  if (evt.which == 27) // On Escape button press 
  {
    document.activeElement.blur();
  }
}