JSFiddle - React, Tailwind, and code Playground

HTML

<input id="input"></input>

JavaScript

window.onfocus = function() {
 document.getElementById("input").focus();
}
document.getElementById("input").onfocus = function() {
  console.log("Сработал обработчик фокуса на поле");
}