1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix video OSD not hiding

Sometimes (maybe in some browsers) onHideAnimationComplete
is called on btnPause, and the event listener is disconnecting
because it was connected with "once: true".

As a result, the `hide` class is not added to the OSD element,
allowing the user to interact with transparent elements.

Don't connect listener with "once: true".
This commit is contained in:
Dmitry Lyzo 2024-06-02 18:32:40 +03:00
parent d9c5440864
commit cbedc384b3

View file

@ -323,18 +323,14 @@ export default function (view) {
}
function clearHideAnimationEventListeners(elem) {
dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true
});
elem.removeEventListener(transitionEndEventName, onHideAnimationComplete);
}
function onHideAnimationComplete(e) {
const elem = e.target;
if (elem != osdBottomElement) return;
elem.classList.add('hide');
dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true
});
elem.removeEventListener(transitionEndEventName, onHideAnimationComplete);
}
const _focus = debounce((focusElement) => focusManager.focus(focusElement), 50);
@ -364,9 +360,7 @@ export default function (view) {
clearHideAnimationEventListeners(elem);
elem.classList.add('videoOsdBottom-hidden');
dom.addEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true
});
elem.addEventListener(transitionEndEventName, onHideAnimationComplete);
currentVisibleMenu = null;
toggleSubtitleSync('hide');