Backport pull request #6413 from jellyfin-web/release-10.10.z

Prevent Focus Loss When Skip Button is Pressed

Original-merge: 4f17cebc02c6cf5a2d9779b8861f98c9aa9e3e93

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: thornbill <thornbill@users.noreply.github.com>
This commit is contained in:
rlauuzo
2025-01-22 03:12:46 -05:00
committed by thornbill
parent 05cce43ffd
commit 34ace6bc11
3 changed files with 41 additions and 16 deletions
+14 -12
View File
@@ -93,22 +93,24 @@ function isCurrentlyFocusableInternal(elem) {
// Determines if a focusable element can be focused at a given point in time
function isCurrentlyFocusable(elem) {
if (elem.disabled) {
return false;
}
if (elem.getAttribute('tabindex') === '-1') {
return false;
}
if (elem.tagName === 'INPUT') {
const type = elem.type;
if (type === 'range') {
if (!elem.classList?.contains('focusable')) {
if (elem.disabled) {
return false;
}
if (type === 'file') {
if (elem.getAttribute('tabindex') === '-1') {
return false;
}
if (elem.tagName === 'INPUT') {
const type = elem.type;
if (type === 'range') {
return false;
}
if (type === 'file') {
return false;
}
}
}
return isCurrentlyFocusableInternal(elem);
+9
View File
@@ -20,6 +20,15 @@ interface ShowOptions {
function onHideComplete(this: HTMLButtonElement) {
if (this) {
// Handle focus after the hide transition completes
if (document.activeElement === this) {
this.blur();
const pauseButton = document.querySelector('.btnPause');
if (pauseButton && focusManager.isCurrentlyFocusable(pauseButton)) {
focusManager.focus(pauseButton);
}
}
this.classList.add('hide');
}
}