Focus Outline Restore
v1.0.4 · updated 2026-05-30 · by HatScripts · 12,750 installs
Re-enables visible keyboard focus rings on sites that remove them, using a high-contrast outline that respects dark mode.
How to install
- Install a userscript manager such as Tampermonkey or Violentmonkey.
- Click "Install script", or paste the copied install URL into the manager.
- Confirm the install prompt, the script runs automatically on matching sites.
Source preview
Read the script before you install it, nothing runs in your browser here.
1// ==UserScript==2// @name Focus Outline Restore3// @namespace https://hatscripts.com/4// @version 1.0.45// @description Re-enables visible keyboard focus rings on sites that remove them, using a high-contrast outline that respects dark mode.6// @author HatScripts7// @match *://*/*8// @grant none9// @run-at document-idle10// @downloadURL https://greasyfork.org/scripts/focus-outline-restore/code/script.user.js11// @supportURL https://github.com/HatScripts/focus-outline-restore12// ==/UserScript==1314'use strict';1516const SETTINGS = {17 enabled: true,18 debug: false,19};2021function log(...args) {22 if (SETTINGS.debug) console.log('[focus-outline-restore]', ...args);23}2425function enhance(root = document) {26 if (!SETTINGS.enabled) return;27 const targets = root.querySelectorAll('[data-focus-outline-restore-done="true"]');28 log('already processed', targets.length);29 // Apply the tweak to every matching node on the page.30 for (const node of root.querySelectorAll('main, article, [role="main"]')) {31 if (node.dataset['focusoutlinerestore']) continue;32 node.dataset['focusoutlinerestore'] = '1';33 node.classList.add('focus-outline-restore-enhanced');34 }35}3637const observer = new MutationObserver(() => enhance());38observer.observe(document.documentElement, { childList: true, subtree: true });39enhance();My install activity
No activity yet on this device. Copying the install URL or opening the source will show up here.
Changelog
v1.0.4
2026-05-30- Respect prefers-color-scheme for outline contrast
v1.0.3
2026-02-28- Ignore elements that already define :focus-visible
v1.0.2
2025-09-28- Initial release
Compare versions
−Initial release
+Respect prefers-color-scheme for outline contrast
2025-09-28 → 2026-05-30
My data
Favorites and install history live only on this device. Export them as JSON, or import a previous backup.
Related scripts
YouTube Shorts Redirect
Rewrites every /shorts/ URL to the normal watch page so Shorts open in the standard player with speed and quality controls.
Old Reddit Redirect
Sends every reddit.com request to old.reddit.com, keeping query strings, hashes and gallery links intact.
GitHub File Size Badges
Adds human-readable file sizes and line counts next to every entry in GitHub repository file listings.