Skip to content

Instantly share code, notes, and snippets.

@gillibrand
Created March 5, 2016 15:01
Show Gist options
  • Save gillibrand/e240b129ae748b9e2291 to your computer and use it in GitHub Desktop.
Save gillibrand/e240b129ae748b9e2291 to your computer and use it in GitHub Desktop.
// javascript:(function()%20{if%20(window.___focusInterval)%20{clearInterval(window.___focusInterval);delete%20window.___focusInterval;return;}window.___focusInterval%20=%20setInterval(function()%20{console.debug(document.activeElement);}%2C%202000);})();
// Logs the :focus-ed element every few seconds. This can be helpful when
// debugging why the focus is getting lost or is on a visually hidden element.
// Toggles the logging on or off.
(function() {
if (window.___focusInterval) {
clearInterval(window.___focusInterval);
delete window.___focusInterval;
return;
}
window.___focusInterval = setInterval(function() {
console.debug(document.activeElement);
}, 2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment