Skip to content

Instantly share code, notes, and snippets.

@bkardell
Last active August 29, 2015 14:24
Show Gist options
  • Save bkardell/d444e006bd6cfbc99986 to your computer and use it in GitHub Desktop.
Save bkardell/d444e006bd6cfbc99986 to your computer and use it in GitHub Desktop.
An experiment in effectively managing focus rings
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);
});
@philippeschneide
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment