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
|
@ -59,6 +59,9 @@ import layoutManager from './layoutManager';
|
||||||
candidates.push(container.querySelector('.btnPreviousPage'));
|
candidates.push(container.querySelector('.btnPreviousPage'));
|
||||||
} else if (activeElement.classList.contains('btnSelectView')) {
|
} else if (activeElement.classList.contains('btnSelectView')) {
|
||||||
candidates.push(container.querySelector('.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);
|
candidates.push(activeElement);
|
||||||
|
|
|
@ -33,6 +33,12 @@ import ServerConnections from '../../components/ServerConnections';
|
||||||
import confirm from '../../components/confirm/confirm';
|
import confirm from '../../components/confirm/confirm';
|
||||||
import { download } from '../../scripts/fileDownloader';
|
import { download } from '../../scripts/fileDownloader';
|
||||||
|
|
||||||
|
function autoFocus(container) {
|
||||||
|
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
|
||||||
|
autoFocuser.autoFocus(container);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getPromise(apiClient, params) {
|
function getPromise(apiClient, params) {
|
||||||
const id = params.id;
|
const id = params.id;
|
||||||
|
|
||||||
|
@ -368,12 +374,12 @@ function reloadPlayButtons(page, item) {
|
||||||
hideAll(page, 'btnShuffle');
|
hideAll(page, 'btnShuffle');
|
||||||
}
|
}
|
||||||
|
|
||||||
const btnResume = page.querySelector('.mainDetailButtons .btnResume');
|
if (layoutManager.tv) {
|
||||||
const btnPlay = page.querySelector('.mainDetailButtons .btnPlay');
|
const btnResume = page.querySelector('.mainDetailButtons .btnResume');
|
||||||
if (layoutManager.tv && !btnResume.classList.contains('hide')) {
|
const btnPlay = page.querySelector('.mainDetailButtons .btnPlay');
|
||||||
btnResume.classList.add('fab');
|
const resumeHidden = btnResume.classList.contains('hide');
|
||||||
} else if (layoutManager.tv && btnResume.classList.contains('hide')) {
|
btnResume.classList.toggle('raised', !resumeHidden);
|
||||||
btnPlay.classList.add('fab');
|
btnPlay.classList.toggle('raised', resumeHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
return canPlay;
|
return canPlay;
|
||||||
|
@ -721,9 +727,7 @@ function reloadFromItem(instance, page, params, item, user) {
|
||||||
hideAll(page, 'btnDownload', true);
|
hideAll(page, 'btnDownload', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
|
autoFocus(page);
|
||||||
autoFocuser.autoFocus(page);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function logoImageUrl(item, apiClient, options) {
|
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
|
// HACK: Call autoFocuser again because btnPlay may be hidden, but focused by reloadFromItem
|
||||||
// FIXME: Sometimes focus does not move until all (?) sections are loaded
|
// FIXME: Sometimes focus does not move until all (?) sections are loaded
|
||||||
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
|
autoFocus(page);
|
||||||
autoFocuser.autoFocus(page);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCollectionItemType(page, parentItem, type, items) {
|
function renderCollectionItemType(page, parentItem, type, items) {
|
||||||
|
@ -2054,6 +2056,7 @@ export default function (view, params) {
|
||||||
currentItem.UserData = userData;
|
currentItem.UserData = userData;
|
||||||
reloadPlayButtons(view, currentItem);
|
reloadPlayButtons(view, currentItem);
|
||||||
refreshImage(view, currentItem);
|
refreshImage(view, currentItem);
|
||||||
|
autoFocus(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue