Reviews for Tab Switch
Tab Switch by Awuthme
1 review
- Rated 4 out of 5by Andy19823981273, 8 months agoWorks very well except the add-on interferes with YouTube's keyboard shortcuts. When you use ctrl+(left or right arrow) on Youtube you switch chapters. I've been looking for a solution to this problem but can't find one. I would appreciate any help bc I do really like this add-on.
EDIT: Nvm I found a solution. Using Tampermonkey add-on I used the following script so that the Tab Switch add-on works before Youtube notices the shortcut being used.
// ==UserScript==
// @name Prioritize Tab-Switching over YouTube Shortcuts
// @namespace http://tampermonkey.net/
// @version 0.6
// @description Ensure tab-switching extension works without YouTube intercepting the shortcut
// @author You
// @match *://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Listen for the keydown event at the capture phase
window.addEventListener('keydown', function(event) {
// Check if Ctrl key is pressed and if the key is left or right arrow
if (event.ctrlKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
// Prevent YouTube from knowing about this key event
event.stopImmediatePropagation(); // Stop YouTube from handling the event
// Do not prevent the default action to allow the tab-switching extension to work
}
}, {capture: true, passive: true});
})();