JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text">
JavaScript
/**
* для вопроса https://qna.habr.com/q/1030602
* Как отслеживать что с полем input никаких действий больше не производится?
*/
const defocus = (el) => {
let timer;
el.addEventListener('input', () => {
if (timer) clearTimeout(timer);
timer = setTimeout(() => el.blur(), 5e3);
})
}
// Использование
defocus(document.querySelector('input'));