You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some websites that bind ArrowRight and ArrowLeft for video time line jumping and their programmers were so incompetent to accidentally also bind the Firefox shortcuts for history navigation Alt-Left and Alt-Right.
Please have a look at my TamperMonkey user script to keep the shortcuts. I dedicate this source code to the public domain or put it to Creative Commons CC0 "No Rights Reserved" whatever you prefer.
// ==UserScript==
// @name KeepHistoryShortcuts
// @namespace https://github.com/nalply
// @version 2024-06-01
// @description Alt-Left and Alt-Right are shortcuts to navigate history. Keep them!
// @author nalply
// @match https://*/*
// @run-at dpcument-start
// @grant none
// ==/UserScript==
// Capture keydown events before anything else and stops propagation for Alt-ArrowLeft and Alt-ArrowRight.
// This needs run-at: document-start and { capture: true } as third parameter to addEventListener().
'use strict'
console.log("KHS: KeepHistoryShortcuts user script started")
document.addEventListener('keydown', forceDefault, { capture: true })
function forceDefault(ev) {
if (ev.altKey && (ev.key == "ArrowRight" || ev.key == "ArrowLeft")) {
console.log("KHS: keypress kept for browser", ev.key)
ev.stopImmediatePropagation()
}
}
Hi,
I'm actually looking for a way to outsmart websites from hijacking keyboard shortcuts.
Known offenders:
Both of them override the [alt + numerical key] which is a big pain in the ass.
My hope was that by using this browser extension, I could override what they have done but that doesn't work.
Would this be possible in theory by making changes to this extension?
The text was updated successfully, but these errors were encountered: