Something went wrong. Try again.
softfork of @juliet.paris parfait forked from juliet.paris/parfait
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031/** * Whether you're pointing or using the keys, for the focus ring: browsers take any key for the * keyboard, Shift alone too, and ring what's focused, often only the button just clicked (a * Shift-click's Shift, say). Marked while the last thing done was a press of the pointer, until a * key other than Shift, Ctrl, Alt or ⌘ is pressed; while marked, nothing is ringed (index.css). */// And keys a browser can't name, which aren't moving through the page either.const MODIFIERS = new Set([ "Shift", "Control", "Alt", "Meta", "CapsLock", "Fn", "", "Unidentified",]);const root = document.documentElement;
addEventListener("pointerdown", () => root.toggleAttribute("data-pointing", true), { capture: true, passive: true,});addEventListener( "keydown", (event) => { if (!MODIFIERS.has(event.key)) root.removeAttribute("data-pointing"); }, { capture: true },);