-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
The following patch sets the focus to the first element of the searchFragment (if present).
The user can tab to move the focus to the first item, but in this case setting focus is probably better.
Since the searchFragment is at the top of the page, we don't have issues with scrolling the form into
view and losing context.
diff --git a/html/classhelper.js b/html/classhelper.js
index 3ff630ef..44d98c17 100644
--- a/html/classhelper.js
+++ b/html/classhelper.js
@@ -565,6 +567,7 @@ class ClassHelper extends HTMLElement {
label.setAttribute("for", param);
label.textContent = ClassHelper.translations[param] + ":";
+ let focusSet = false
let input;
if (this.dropdownsData[param]) {
input = document.createElement("select");
@@ -601,6 +604,10 @@ class ClassHelper extends HTMLElement {
input.setAttribute("name", param);
input.setAttribute("id", param);
input.classList.add("search-input"); // Add class for styling
+ if (!focusSet) {
+ input.setAttribute("autofocus", "");
+ focusSet = true;
+ }
labelCell.appendChild(label);
inputCell.appendChild(input);
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done