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

Add timeouts to focus

This commit is contained in:
MrTimscampi 2020-08-16 21:07:49 +02:00
parent 667576e056
commit 458587475c
2 changed files with 9 additions and 5 deletions

View file

@ -532,7 +532,9 @@ import layoutManager from 'layoutManager';
if (isEnabled()) {
dom.addEventListener(window, 'focusin', function(e) {
scrollToElement(e.target, useSmoothScroll());
setTimeout(function() {
scrollToElement(e.target, useSmoothScroll());
}, 0);
}, {capture: true});
}

View file

@ -17,10 +17,12 @@ import 'css!./emby-scroller';
function initCenterFocus(elem, scrollerInstance) {
dom.addEventListener(elem, 'focus', function (e) {
const focused = focusManager.focusableParent(e.target);
if (focused) {
scrollerInstance.toCenter(focused);
}
setTimeout(function() {
const focused = focusManager.focusableParent(e.target);
if (focused) {
scrollerInstance.toCenter(focused);
}
}, 0);
}, {
capture: true,
passive: true