Skip to content

Commit 82084e2

Browse files
committed
Dropdown list appears on focus
1 parent 1f7b8c8 commit 82084e2

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

static/foundation/js/vendor/tagging.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ export function setupTagging({
9797
updateHidden();
9898
input.value = "";
9999
if (suggestionsBox) suggestionsBox.style.display = "none";
100-
input.classList.remove("invalid", "invalid-required", "invalid-recommended"); // Remove invalid color immediately
100+
input.classList.remove(
101+
"invalid",
102+
"invalid-required",
103+
"invalid-recommended"
104+
); // Remove invalid color immediately
101105
input.blur();
102106
}
103107

@@ -107,13 +111,12 @@ export function setupTagging({
107111
highlightTag.classList.add("highlight-tag");
108112
highlightTag.innerHTML = `⚠️ Suggestion: Curate here <span class="acknowledge-tag">Got it!</span>`;
109113
container.insertBefore(highlightTag, input);
114+
} else if (!useAutocomplete) {
115+
const highlightTag = document.createElement("span");
116+
highlightTag.classList.add("highlight-tag");
117+
highlightTag.innerHTML = `⚠️ Multiple entries supported: please press enter after typing each <span class="acknowledge-tag">Got it!</span>`;
118+
container.insertBefore(highlightTag, input);
110119
}
111-
else if (!useAutocomplete) {
112-
const highlightTag = document.createElement("span");
113-
highlightTag.classList.add("highlight-tag");
114-
highlightTag.innerHTML = `⚠️ Multiple entries supported: please press enter after typing each <span class="acknowledge-tag">Got it!</span>`;
115-
container.insertBefore(highlightTag, input);
116-
}
117120

118121
if (useAutocomplete && suggestionsBox) {
119122
input.addEventListener("input", () => {
@@ -203,7 +206,6 @@ export function setupTagging({
203206
// Show all suggestions if input is empty, or filtered if not
204207
const query = input.value.trim().toLowerCase();
205208
suggestionsBox.innerHTML = "";
206-
207209
// Filter as in your input event
208210
const filtered = autocompleteSource.filter(
209211
(tag) =>
@@ -237,9 +239,10 @@ export function setupTagging({
237239
});
238240

239241
// Position the suggestion box
240-
const rect = input.getBoundingClientRect();
241-
updateSuggestionsBoxPosition(input, suggestionsBox)
242-
suggestionsBox.style.position = "fixed";
242+
// const rect = input.getBoundingClientRect();
243+
updateSuggestionsBoxPosition(input, suggestionsBox);
244+
suggestionsBox.style.display = "block";
245+
suggestionsBox.style.position = "fixed";
243246
});
244247

245248
document.addEventListener("click", (e) => {
@@ -659,4 +662,3 @@ function setupAcknowledgeTags() {
659662
});
660663
});
661664
}
662-

0 commit comments

Comments
 (0)