JSFiddle - React, Tailwind, and code Playground

by David Iglesias

HTML

<div id="body">
  <input type="text" id="input1" />
  <input type="text" id="input2" />
</div>

JavaScript

body.addEventListener('focusout', (e) => {
  console.log(e.type, e.target, e.relatedTarget);
});

body.addEventListener('focusin', (e) => {
  console.log(e.type, e.target, e.relatedTarget);
});

body.addEventListener('keydown', (e) => {
  console.log('keydown', e.shiftKey, e.key === "Tab");
});

body.addEventListener('keyup', (e) => {
  console.log('keyup', e.shiftKey);
});

console.log(input1);