From 754d14f3250210a711ab5ad333097c8bdf7ec14f Mon Sep 17 00:00:00 2001 From: rlauu <46294892+rlauu@users.noreply.github.com> Date: Sun, 5 Jan 2025 08:51:31 +0100 Subject: [PATCH] Apply suggested changes --- src/components/focusManager.js | 25 +++++++++++++++---------- src/controllers/playback/video/index.js | 5 ++++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/components/focusManager.js b/src/components/focusManager.js index 66f6688d072..8dd0f6dd518 100644 --- a/src/components/focusManager.js +++ b/src/components/focusManager.js @@ -93,19 +93,24 @@ function isCurrentlyFocusableInternal(elem) { // Determines if a focusable element can be focused at a given point in time function isCurrentlyFocusable(elem) { - if (elem.disabled) { - return false; - } - - if (elem.getAttribute('tabindex') === '-1') { - return false; - } + if (!elem.classList?.contains('focusable')) { + if (elem.disabled) { + return false; + } - if (elem.tagName === 'INPUT') { - const type = elem.type; - if (type === 'file') { + if (elem.getAttribute('tabindex') === '-1') { return false; } + + if (elem.tagName === 'INPUT') { + const type = elem.type; + if (type === 'range') { + return false; + } + if (type === 'file') { + return false; + } + } } return isCurrentlyFocusableInternal(elem); diff --git a/src/controllers/playback/video/index.js b/src/controllers/playback/video/index.js index f00a7c95b51..b95183deaea 100644 --- a/src/controllers/playback/video/index.js +++ b/src/controllers/playback/video/index.js @@ -304,11 +304,13 @@ export default function (view) { } function slideDownToShow(elem) { + clearHideAnimationEventListeners(elem); elem.classList.remove('hide'); elem.classList.remove('osdHeader-hidden'); } function slideUpToHide(elem) { + clearHideAnimationEventListeners(elem); elem.classList.add('osdHeader-hidden'); elem.addEventListener(transitionEndEventName, onHideAnimationComplete); } @@ -365,7 +367,8 @@ export default function (view) { toggleSubtitleSync('hide'); // Firefox does not blur by itself - if (document.activeElement && !focusManager.isCurrentlyFocusable(document.activeElement)) { + if (osdBottomElement.contains(document.activeElement) + || headerElement.contains(document.activeElement)) { document.activeElement.blur(); } }