You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
439 B
14 lines
439 B
// 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();
|
|
}
|
|
}
|
|
}
|