Skip to content

Commit 5a14915

Browse files
committed
Minor improvement
1 parent 26e38a5 commit 5a14915

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib/components/common/Modal.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
hideErrorAlert();
2121
onOpen();
2222
});
23+
modal.addEventListener('shown.bs.modal', () => {
24+
// Automatically set focus on first input element (if any)
25+
const firstInput = document.querySelector(`#${id} input`);
26+
if (firstInput instanceof HTMLElement) {
27+
firstInput.focus();
28+
}
29+
});
2330
modal.addEventListener('hidden.bs.modal', onClose);
2431
}
2532
});

0 commit comments

Comments
 (0)