Last active
August 29, 2015 14:24
-
-
Save bkardell/d444e006bd6cfbc99986 to your computer and use it in GitHub Desktop.
An experiment in effectively managing focus rings
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
document.addEventListener("DOMContentLoaded", function () { | |
document.body.addEventListener("mousedown", function (evt) { | |
if (!evt.target.setSelectionRange || evt.target.role === 'textbox' || evt.target.hasAttribute("disable-point-focus")) { | |
evt.target.setAttribute("point-focused", true); | |
} | |
}); | |
document.body.addEventListener("blur", function (evt) { | |
evt.srcElement.removeAttribute("point-focused"); | |
}, true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Showing more of the focus rings for those who need them (keyboard users) is the right thing. I like that the mouse user is seeing less of them.