Skip to content

Life-Experimentalist/Youtube-Keystrokes-Blocker

Repository files navigation

YouTube Keystrokes Blocker

YouTube Keystrokes Blocker Logo

Block distracting YouTube keyboard shortcuts while keeping the ones you need — available as a native browser extension and a userscript.

Version GitHub Stars GitHub Issues GitHub Last Commit Greasy Fork License JavaScript Chrome MV3 Edge Add-on Firefox MV3

📌 Features

Fine-Grained Control

  • Individually toggle each YouTube hotkey — enable only what you need, block everything else
  • Modern settings modal integrated directly into YouTube's player interface
  • 30+ independent hotkey toggles

🎯 Complete Hotkey Coverage

  • Number Keys (0–9) — Jump to timeline percentage
  • Spacebar — Play/Pause toggle
  • Arrow Keys — Timeline navigation (Left/Right ±5s) and volume (Up/Down)
  • Ctrl + Left / Right — Chapter navigation
  • F Key — Fullscreen toggle
  • M Key — Mute/Unmute
  • K Key — Play/Pause (alternative)
  • J / L Keys — Seek ±10 seconds
  • T Key — Theatre mode toggle
  • C Key — Captions toggle
  • I Key — Mini player toggle
  • Shift + < / > — Playback speed control
  • Period / Comma — Frame-by-frame navigation
  • Home / End — Jump to beginning/end

🔐 Smart Context Detection

  • Automatically ignores key presses when typing in search, comments, or chat
  • Preserves all non-blocked YouTube functionality unchanged

⚙️ Persistent Settings

  • Settings saved locally — no accounts, no cloud, no privacy concerns
  • Survives page navigations and SPA transitions

🧩 Two Ways to Install

  • Native browser extension for Chrome, Firefox, and Edge (Manifest V3)
  • Userscript for Tampermonkey, Greasemonkey, and Violentmonkey

🚀 Installation

Option A: Browser Extension (Native)

No userscript manager required. Installs directly into Chrome, Firefox, or Edge.

Chrome & Edge

  1. Download youtube-hotkeys-blocker-v5.0.0-chrome.zip from GitHub Releases
  2. Unzip the file to a folder
  3. Chrome: navigate to chrome://extensions/ | Edge: navigate to edge://extensions/
  4. Enable Developer Mode (toggle in the top-right)
  5. Click Load unpacked and select the unzipped folder
  6. The extension icon appears in your toolbar

Chrome Web Store and Edge Add-ons submissions are in progress — check Releases for store links when available.

Firefox

  1. Download youtube-hotkeys-blocker-v5.0.0-firefox.zip from GitHub Releases
  2. In Firefox navigate to about:debugging#/runtime/this-firefox
  3. Click Load Temporary Add-on… and select the .zip directly
  4. The extension activates immediately on YouTube

Firefox AMO submission is in progress — check Releases for the store link when available.


Option B: Userscript

Requires a userscript manager. Works on any browser that supports one.

Step 1 — Install a Userscript Manager

Manager Chrome Firefox Edge Safari
Tampermonkey
Greasemonkey
Violentmonkey

Step 2 — Install the Script

From Greasy Fork (Recommended — auto-updates daily):

Install from Greasy Fork

Direct GitHub install:

👉 Click to install from GitHub

Manual:

  1. Open your userscript manager dashboard
  2. Create a new script
  3. Paste the contents of disable-yt-hotkeys.user.js
  4. Save and enable

💡 Usage

Opening Settings

Browser Extension:

  • Click the toolbar icon to open the popup
  • Or press Alt+Shift+H (Windows/Linux) / Cmd+Shift+H (Mac) from any YouTube page

Userscript:

  • Look for the ⌨️ keyboard icon in the YouTube video player controls
  • Or open your userscript manager menu → "YouTube Hotkey Settings"

Default Configuration

Hotkey Blocked by Default
Numbers (0–9) ✅ Yes
Ctrl + Left ✅ Yes
Ctrl + Right ✅ Yes
M (Mute) ✅ Yes
Spacebar ❌ No
Arrow Keys ❌ No
F (Fullscreen) ❌ No
Speed (Shift+<>) ❌ No
Frame Skip (./,) ❌ No

🛠️ Configuration

All settings are stored locally via chrome.storage.sync (extension) or GM_setValue (userscript). No external servers involved.

Full Settings Reference

Setting Key Default Description
Disable Numbers (0–9) disableNumbers ✅ ON Blocks timeline jump shortcuts
Disable Spacebar disableSpacebar OFF Blocks play/pause
Disable Arrow Keys disableArrowKeys OFF Blocks timeline/volume navigation
Disable Ctrl+Left disableCtrlLeft ✅ ON Blocks previous chapter
Disable Ctrl+Right disableCtrlRight ✅ ON Blocks next chapter
Disable F (Fullscreen) disableF OFF Blocks fullscreen toggle
Disable M (Mute) disableM ✅ ON Blocks mute toggle
Disable K (Play/Pause) disableK OFF Blocks K key play/pause
Disable J (Seek −10s) disableJ OFF Blocks 10-second rewind
Disable L (Seek +10s) disableL OFF Blocks 10-second skip
Disable T (Theatre) disableT OFF Blocks theatre mode
Disable C (Captions) disableC OFF Blocks caption toggle
Disable I (Mini Player) disableI OFF Blocks mini player
Disable Speed (Shift+<>) disableSpeed OFF Blocks speed controls
Disable Frame Skip (./,) disableFrameSkip OFF Blocks frame-by-frame navigation
Disable Home/End disableHomeEnd OFF Blocks jump to start/end

⌨️ Extension Keyboard Commands

When installed as a browser extension, the following shortcut is available:

Command Windows / Linux Mac
Open Settings Popup Alt+Shift+H Cmd+Shift+H

To customize this shortcut:

  • Chrome/Edge: chrome://extensions/shortcuts
  • Firefox: about:addons → gear icon → Manage Extension Shortcuts

🔍 How It Works

  1. Intercepts keyboard events on www.youtube.com at document_start
  2. Checks each key against your saved settings
  3. Calls preventDefault() and stopImmediatePropagation() for blocked keys, preventing YouTube from processing them
  4. Skips blocking when focus is in a search box, comment field, or any other text input
  5. Watches for SPA navigation (yt-navigate-finish) to re-attach handlers after YouTube's client-side page transitions
  6. Persists settings using chrome.storage.sync (extension) or GM_setValue (userscript) — no external servers

🐛 Troubleshooting

Extension not working?

  • Verify the extension is enabled at chrome://extensions/ or about:addons
  • Reload the YouTube tab after enabling
  • Check that the *://www.youtube.com/* host permission is granted

Userscript not working?

  • Ensure your userscript manager is enabled for YouTube
  • Reload the YouTube page
  • Check that no other extensions are intercepting keyboard events before this one

Settings not saving?

  • Extension: confirm the storage permission is granted
  • Userscript: confirm your manager allows GM_setValue on youtube.com
  • Disable any aggressive privacy extensions temporarily to test

Keyboard icon not showing (userscript only)?

  • Refresh the YouTube page
  • Navigate to a video — the button injects into the player controls after the player loads
  • Use the userscript manager menu as a fallback access method

Need help?

Open an issue on GitHub


🔧 Development

Project Structure

Youtube Keystrokes Blocker/
├── disable-yt-hotkeys.user.js     # Userscript (single-file, self-contained)
├── src/
│   ├── content.js                 # Extension content script
│   ├── background.js              # Extension service worker
│   ├── content.css                # Content script styles
│   ├── popup/                     # Toolbar popup UI
│   ├── options/                   # Full options page UI
│   ├── manifests/
│   │   ├── manifest.chrome.json   # Chrome/Edge MV3 manifest
│   │   └── manifest.firefox.json  # Firefox MV3 manifest
│   └── icons/                     # SVG source icon
├── scripts/
│   ├── Build-Extension.ps1        # Builds Chrome + Firefox ZIPs
│   ├── Build-All.ps1              # Builds extension + copies userscript
│   └── Update-Version.ps1         # Bumps version across all files
├── release/                       # Built artifacts (git-ignored)
└── docs/                          # Documentation

Build Commands

# Build all artifacts (extension ZIPs + userscript copy)
npm run build:all

# Build extension packages only
npm run build:extension

# Version management
npm run version:patch    # 5.0.0 → 5.0.1
npm run version:minor    # 5.0.0 → 5.1.0
npm run version:major    # 5.0.0 → 6.0.0

# Full release (version bump + build)
npm run release

📝 License

Licensed under the Apache License 2.0 — see LICENSE.md for details.

🤝 Contributing

  1. Fork the repository
  2. Make your changes
  3. Open a pull request

Bug reports and feature requests are welcome on GitHub Issues.


👨‍💻 Author

Created and maintained by VKrishna04

Part of the Life Experimentalist organization

🌐 Links

🏠 Homepage yt-hotkeys.vkrishna04.me
📦 GitHub Life-Experimentalist/Youtube-Keystrokes-Blocker
🐛 Issues GitHub Issues
📋 Releases GitHub Releases
📦 Greasy Fork Script page
📊 Changelog CHANGELOG.md

Last Updated: 2026 | Version 5.0.0 | Active Development

⭐ If you find this useful, please star the repository!

About

A powerful userscript that gives you fine-grained control over YouTube keyboard shortcuts. Block distracting hotkeys while keeping the ones you need active.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors