Keep focus out of the hidden update dialog after closing
CI / verify (push) Canceled after 0s

When the dialog was opened without a usable focus target, closing it left
keyboard focus on a button inside the hidden overlay. Fall back to the
header update action, or clear focus when that is not available.
This commit is contained in:
Sucukdeluxe committed 2026-09-26 05:21:22 +02:00
1 parent 5157655354
commit bbc4a98fb9
1 file changed
+6 -1
+6 -1
View File
@@ -9750,7 +9750,12 @@ function _setUpdateDialogVisible(visible) {
_setUpdateBackgroundInert(false); _setUpdateBackgroundInert(false);
const returnFocus = _updateDialogReturnFocus; const returnFocus = _updateDialogReturnFocus;
_updateDialogReturnFocus = null; _updateDialogReturnFocus = null;
if (returnFocus && returnFocus.isConnected && typeof returnFocus.focus === 'function') returnFocus.focus(); if (returnFocus && returnFocus !== document.body && returnFocus.isConnected && typeof returnFocus.focus === 'function') returnFocus.focus();
if (overlay.contains(document.activeElement)) {
const headerButton = document.getElementById('headerUpdateBtn');
if (headerButton && !headerButton.disabled && headerButton.getClientRects().length > 0) headerButton.focus();
if (overlay.contains(document.activeElement)) document.activeElement.blur();
}
} }
} }