diff --git a/js&css/web-accessible/functions.js b/js&css/web-accessible/functions.js index a54cbd166..fee8dcd10 100644 --- a/js&css/web-accessible/functions.js +++ b/js&css/web-accessible/functions.js @@ -408,7 +408,7 @@ ImprovedTube.playerOnPause = function (event) { if (document.documentElement.dataset.pageType === 'video' && (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript === true || ImprovedTube.storage.chapters === true )) { ImprovedTube.forbidFocus = function (ms) { - const originalFocus = HTMLElement.prototype.focus; // Backing up default method - other methods: Element.prototype.scrollIntoView window.scrollTo window.scrollBy + originalFocus = HTMLElement.prototype.focus; // Backing up default method - other methods: Element.prototype.scrollIntoView window.scrollTo window.scrollBy // Override YouTube's scroll method: HTMLElement.prototype.focus = function() {console.log("Preventing YouTube's scripted scrolling, when expanding the video description for you"); } if(document.hidden) ms = 3*ms; diff --git a/js&css/web-accessible/www.youtube.com/shortcuts.js b/js&css/web-accessible/www.youtube.com/shortcuts.js index 38782cbaf..1fc4ee98b 100644 --- a/js&css/web-accessible/www.youtube.com/shortcuts.js +++ b/js&css/web-accessible/www.youtube.com/shortcuts.js @@ -374,7 +374,8 @@ ImprovedTube.shortcutResetPlaybackSpeed = function () { 4.7.19 GO TO SEARCH BOX ------------------------------------------------------------------------------*/ ImprovedTube.shortcutGoToSearchBox = function () { - document.querySelector('input#search')?.focus(); + if (originalFocus) { HTMLElement.prototype.focus = originalFocus } + document.querySelector('input#search')?.focus(); //alternatively .click() }; /*------------------------------------------------------------------------------ 4.7.20 ACTIVATE FULLSCREEN