Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fstorr/45932de7ff29c1a2c263c7d2e1ce7ebf to your computer and use it in GitHub Desktop.
Save fstorr/45932de7ff29c1a2c263c7d2e1ce7ebf to your computer and use it in GitHub Desktop.
Bookmarklet to force focus highlighting in accessibility testing
/*
tweaked version of a bookmarklet I found online (can't remember where now).
Added a `title` attribute to the `<style>` element to make it easier to find in dev tools.
tweaked the outline color and box shadow
*/
javascript:(function()%7Blet a%3Ddocument.createElement('style');a.setAttribute('title','a11y-testing')%3Bdocument.head.appendChild(a)%3Bb%3Da.sheet%3Bb.insertRule(%27*:focus%7Boutline:2px solid hsl(120,100%,50%) !important%3Bbox-shadow: 0 0 0.25em 3px hsla(0,0%,0%,.60) !important%3B%7D%27,0)%3B%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment