Skip to content

Commit 27dcb69

Browse files
committed
Required taggable metadata fields marked red when values are removed
1 parent d89b470 commit 27dcb69

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

static/foundation/js/vendor/tagging.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Highlights suggested input
55
Provides reusable autocomplete logic for table cells and forms*/
66

77
import { getSchema } from "./schema-utils.js";
8+
import { validateInput } from "./ui.js";
89
const SPDX_URL =
910
"https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json";
1011
const metadataJson = document.getElementById("metadata-json");
@@ -102,6 +103,7 @@ export function setupTagging({
102103
"invalid-required",
103104
"invalid-recommended"
104105
); // Remove invalid color immediately
106+
validateInput(input);
105107
input.blur();
106108
}
107109

@@ -268,6 +270,7 @@ export function setupTagging({
268270
}
269271
e.target.parentElement.remove();
270272
updateHidden();
273+
validateInput(input);
271274
}
272275

273276
// 🟡 Edit tag logic
@@ -283,7 +286,7 @@ export function setupTagging({
283286

284287
updateHidden();
285288
renderTags();
286-
289+
validateInput(input);
287290
// Populate input for editing
288291
input.value = value;
289292
input.focus();
@@ -327,7 +330,6 @@ export function setupTagging({
327330
// Reuse Enter key handling
328331
input.dispatchEvent(new KeyboardEvent("keydown", { key: "Enter" }));
329332
}
330-
// input.style.display = "none";
331333
});
332334

333335
// Update hidden input and JSON
@@ -340,6 +342,7 @@ export function setupTagging({
340342
const jsonObject = JSON.parse(metadataJson.value);
341343
jsonObject[jsonKey] = selectedTags;
342344
metadataJson.value = JSON.stringify(jsonObject, null, 2);
345+
validateInput(input);
343346
}
344347

345348
// Initial render
@@ -577,6 +580,7 @@ export function setupTagAutocompleteInput({
577580
div.onclick = function () {
578581
onTagSelected(tag);
579582
suggestionsBox.style.display = "none";
583+
input.focus();
580584
};
581585
suggestionsBox.appendChild(div);
582586
});

0 commit comments

Comments
 (0)