Verifique se um elemento de entrada tem foco
const el = document.querySelector('.username');
console.log(el === document.activeElement);Code language: JavaScript (javascript)
Dangerous Dove