mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Return focused element
This commit is contained in:
parent
22d0a5705d
commit
1f2d8ecc13
1 changed files with 10 additions and 5 deletions
|
@ -65,27 +65,32 @@ define(["focusManager", "layoutManager"], function (focusManager, layoutManager)
|
||||||
candidates = candidates.concat(arrayFrom(container.querySelectorAll(".btnResume")));
|
candidates = candidates.concat(arrayFrom(container.querySelectorAll(".btnResume")));
|
||||||
candidates = candidates.concat(arrayFrom(container.querySelectorAll(".btnPlay")));
|
candidates = candidates.concat(arrayFrom(container.querySelectorAll(".btnPlay")));
|
||||||
|
|
||||||
var notFound = candidates.every(function (element) {
|
var focusedElement;
|
||||||
|
|
||||||
|
candidates.every(function (element) {
|
||||||
if (focusManager.isCurrentlyFocusable(element)) {
|
if (focusManager.isCurrentlyFocusable(element)) {
|
||||||
focusManager.focus(element);
|
focusManager.focus(element);
|
||||||
|
focusedElement = element;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (notFound) {
|
if (!focusedElement) {
|
||||||
// FIXME: Multiple itemsContainers
|
// FIXME: Multiple itemsContainers
|
||||||
var itemsContainer = container.querySelector(".itemsContainer");
|
var itemsContainer = container.querySelector(".itemsContainer");
|
||||||
|
|
||||||
if (itemsContainer) {
|
if (itemsContainer) {
|
||||||
notFound = !focusManager.autoFocus(itemsContainer);
|
focusedElement = focusManager.autoFocus(itemsContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notFound) {
|
if (!focusedElement) {
|
||||||
focusManager.autoFocus(container);
|
focusedElement = focusManager.autoFocus(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return focusedElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue