mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #3340 from jellyfin/fix-focus-play-resume
Fix auto focus on Play/Resume
This commit is contained in:
commit
6c4b204d96
2 changed files with 18 additions and 12 deletions
|
@ -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;
|
||||
|
||||
|
@ -368,12 +374,12 @@ function reloadPlayButtons(page, item) {
|
|||
hideAll(page, 'btnShuffle');
|
||||
}
|
||||
|
||||
const btnResume = page.querySelector('.mainDetailButtons .btnResume');
|
||||
const btnPlay = page.querySelector('.mainDetailButtons .btnPlay');
|
||||
if (layoutManager.tv && !btnResume.classList.contains('hide')) {
|
||||
btnResume.classList.add('fab');
|
||||
} else if (layoutManager.tv && btnResume.classList.contains('hide')) {
|
||||
btnPlay.classList.add('fab');
|
||||
if (layoutManager.tv) {
|
||||
const btnResume = page.querySelector('.mainDetailButtons .btnResume');
|
||||
const btnPlay = page.querySelector('.mainDetailButtons .btnPlay');
|
||||
const resumeHidden = btnResume.classList.contains('hide');
|
||||
btnResume.classList.toggle('raised', !resumeHidden);
|
||||
btnPlay.classList.toggle('raised', resumeHidden);
|
||||
}
|
||||
|
||||
return canPlay;
|
||||
|
@ -721,9 +727,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) {
|
||||
|
@ -1750,9 +1754,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) {
|
||||
|
@ -2054,6 +2056,7 @@ export default function (view, params) {
|
|||
currentItem.UserData = userData;
|
||||
reloadPlayButtons(view, currentItem);
|
||||
refreshImage(view, currentItem);
|
||||
autoFocus(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue