JSFiddle - React, Tailwind, and code Playground
by phloe
HTML
<input id="input" type="text"/>
CSS
html, body {
height: 100%;
}
JavaScript
var start,
input = document.getElementById("input");
input.onblur = function () {
console.log("input blur");
start = new Date();
};
input.onfocus = function () {
console.log("input focus");
start = new Date();
};
document.body.onclick = function () {
console.log("window click ", ((start) ? new Date - start : null), "ms");
start = false;
};