This commit is contained in:
Alexey Berezhok
2024-03-19 22:05:27 +03:00
commit 346a50856b
1572 changed files with 182163 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
// If no dialog is open, focus first input in main content form
// TODO: Replace this with autofocus attributes in the HTML
export default function focusFirstInput() {
const openDialogs = document.querySelectorAll('dialog[open]');
if (openDialogs.length === 0) {
const input = document.querySelector(
'#main-form .form-control:not([disabled]), #main-form .form-select:not([disabled])'
);
if (input) {
input.focus();
}
}
}