document.addEventListener('focusin', function() { console.log('focused: ', document.activeElement) }, true);