Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / dtcrashcourse.html
Last active July 25, 2023 11:36
Code From the Developer Tools Crash Course
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Devtools Test</title>
</head>
<body>
@bkardell
bkardell / click-focus.js
Last active August 29, 2015 14:24
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);
});