Backport pull request #6510 from jellyfin-web/release-10.10.z
Fix re-focusing on pause button when displaying OSD Original-merge: c3c598e1f409b51e5b44cec26bdee6af765d20ef Merged-by: thornbill <thornbill@users.noreply.github.com> Backported-by: thornbill <thornbill@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import escapeHtml from 'escape-html';
|
||||
import debounce from 'lodash-es/debounce';
|
||||
import { playbackManager } from '../../../components/playback/playbackmanager';
|
||||
import browser from '../../../scripts/browser';
|
||||
import dom from '../../../scripts/dom';
|
||||
@@ -326,7 +325,16 @@ export default function (view) {
|
||||
elem.removeEventListener(transitionEndEventName, onHideAnimationComplete);
|
||||
}
|
||||
|
||||
const _focus = debounce((focusElement) => focusManager.focus(focusElement), 50);
|
||||
const _focus = function (focusElement) {
|
||||
// If no focus element is provided, try to keep current focus if it's valid,
|
||||
// otherwise default to pause button
|
||||
const currentFocus = focusElement || document.activeElement;
|
||||
if (!currentFocus || !focusManager.isCurrentlyFocusable(currentFocus)) {
|
||||
focusElement = osdBottomElement.querySelector('.btnPause');
|
||||
}
|
||||
|
||||
if (focusElement) focusManager.focus(focusElement);
|
||||
};
|
||||
|
||||
function showMainOsdControls(focusElement) {
|
||||
if (!currentVisibleMenu) {
|
||||
@@ -336,23 +344,12 @@ export default function (view) {
|
||||
elem.classList.remove('hide');
|
||||
elem.classList.remove('videoOsdBottom-hidden');
|
||||
|
||||
focusElement ||= elem.querySelector('.btnPause');
|
||||
|
||||
if (!layoutManager.mobile) {
|
||||
_focus(focusElement);
|
||||
}
|
||||
toggleSubtitleSync();
|
||||
} else if (currentVisibleMenu === 'osd' && !layoutManager.mobile) {
|
||||
// If no focus element is provided, try to keep current focus if it's valid,
|
||||
// otherwise default to pause button
|
||||
if (!focusElement) {
|
||||
const currentFocus = document.activeElement;
|
||||
if (!currentFocus || !focusManager.isCurrentlyFocusable(currentFocus)) {
|
||||
focusElement = osdBottomElement.querySelector('.btnPause');
|
||||
}
|
||||
}
|
||||
|
||||
if (focusElement) _focus(focusElement);
|
||||
_focus(focusElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user