Last active
March 3, 2020 05:38
DOM Focus Tracker Userscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DOM Focus Tracker (Console) | |
// @version 0.2 | |
// @description A quick and dirty focus tracker, logs the currently focused element to console | |
// @include * | |
// @run-at document-start | |
// ==/UserScript== | |
window.addEventListener("focusout", event => console.log(event.relatedTarget === null ? "The webpage has lost focus" : event.relatedTarget), true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment