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

Fix auto focus on Play/Resume

This commit is contained in:
Dmitry Lyzo 2022-01-15 20:03:13 +03:00
parent ff4236f7a9
commit 22e45c2bf2
2 changed files with 12 additions and 6 deletions

View file

@ -59,6 +59,9 @@ import layoutManager from './layoutManager';
candidates.push(container.querySelector('.btnPreviousPage'));
} else if (activeElement.classList.contains('btnSelectView')) {
candidates.push(container.querySelector('.btnSelectView'));
} else if (activeElement.classList.contains('btnPlay')) {
// Resume has priority over Play
candidates = candidates.concat(Array.from(container.querySelectorAll('.btnResume')));
}
candidates.push(activeElement);

View file

@ -33,6 +33,12 @@ import ServerConnections from '../../components/ServerConnections';
import confirm from '../../components/confirm/confirm';
import { download } from '../../scripts/fileDownloader';
function autoFocus(container) {
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
autoFocuser.autoFocus(container);
});
}
function getPromise(apiClient, params) {
const id = params.id;
@ -727,9 +733,7 @@ function reloadFromItem(instance, page, params, item, user) {
hideAll(page, 'btnDownload', true);
}
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
autoFocuser.autoFocus(page);
});
autoFocus(page);
}
function logoImageUrl(item, apiClient, options) {
@ -1756,9 +1760,7 @@ function renderCollectionItems(page, parentItem, types, items) {
// HACK: Call autoFocuser again because btnPlay may be hidden, but focused by reloadFromItem
// FIXME: Sometimes focus does not move until all (?) sections are loaded
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
autoFocuser.autoFocus(page);
});
autoFocus(page);
}
function renderCollectionItemType(page, parentItem, type, items) {
@ -2060,6 +2062,7 @@ export default function (view, params) {
currentItem.UserData = userData;
reloadPlayButtons(view, currentItem);
refreshImage(view, currentItem);
autoFocus(view);
}
}
}