Skip to content

Commit

Permalink
Apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rlauuzo committed Jan 5, 2025
1 parent 2a6c7eb commit 754d14f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
25 changes: 15 additions & 10 deletions src/components/focusManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/playback/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 754d14f

Please sign in to comment.