@@ -5,6 +5,7 @@ Highlights suggested input
5
5
Provides reusable autocomplete logic for table cells and forms*/
6
6
7
7
import { getSchema } from "./schema-utils.js" ;
8
+ import { validateInput } from "./ui.js" ;
8
9
const SPDX_URL =
9
10
"https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json" ;
10
11
const metadataJson = document . getElementById ( "metadata-json" ) ;
@@ -102,6 +103,7 @@ export function setupTagging({
102
103
"invalid-required" ,
103
104
"invalid-recommended"
104
105
) ; // Remove invalid color immediately
106
+ validateInput ( input ) ;
105
107
input . blur ( ) ;
106
108
}
107
109
@@ -268,6 +270,7 @@ export function setupTagging({
268
270
}
269
271
e . target . parentElement . remove ( ) ;
270
272
updateHidden ( ) ;
273
+ validateInput ( input ) ;
271
274
}
272
275
273
276
// 🟡 Edit tag logic
@@ -283,7 +286,7 @@ export function setupTagging({
283
286
284
287
updateHidden ( ) ;
285
288
renderTags ( ) ;
286
-
289
+ validateInput ( input ) ;
287
290
// Populate input for editing
288
291
input . value = value ;
289
292
input . focus ( ) ;
@@ -327,7 +330,6 @@ export function setupTagging({
327
330
// Reuse Enter key handling
328
331
input . dispatchEvent ( new KeyboardEvent ( "keydown" , { key : "Enter" } ) ) ;
329
332
}
330
- // input.style.display = "none";
331
333
} ) ;
332
334
333
335
// Update hidden input and JSON
@@ -340,6 +342,7 @@ export function setupTagging({
340
342
const jsonObject = JSON . parse ( metadataJson . value ) ;
341
343
jsonObject [ jsonKey ] = selectedTags ;
342
344
metadataJson . value = JSON . stringify ( jsonObject , null , 2 ) ;
345
+ validateInput ( input ) ;
343
346
}
344
347
345
348
// Initial render
@@ -577,6 +580,7 @@ export function setupTagAutocompleteInput({
577
580
div . onclick = function ( ) {
578
581
onTagSelected ( tag ) ;
579
582
suggestionsBox . style . display = "none" ;
583
+ input . focus ( ) ;
580
584
} ;
581
585
suggestionsBox . appendChild ( div ) ;
582
586
} ) ;
0 commit comments