Skip to content

Commit 4aab5b7

Browse files
author
John P. rouillard
committed
feat: issue #67 - Set focus to first input in search fragment
1 parent c39545e commit 4aab5b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

html/classhelper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ class ClassHelper extends HTMLElement {
565565
label.setAttribute("for", param);
566566
label.textContent = ClassHelper.translations[param] + ":";
567567

568+
let focusSet = false
568569
let input;
569570
if (this.dropdownsData[param]) {
570571
input = document.createElement("select");
@@ -601,6 +602,10 @@ class ClassHelper extends HTMLElement {
601602
input.setAttribute("name", param);
602603
input.setAttribute("id", param);
603604
input.classList.add("search-input"); // Add class for styling
605+
if (!focusSet) {
606+
input.setAttribute("autofocus", "");
607+
focusSet = true;
608+
}
604609

605610
labelCell.appendChild(label);
606611
inputCell.appendChild(input);

0 commit comments

Comments
 (0)