Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Closed vocabulary fields give no feedback when free text is typed and not selected

Aperta Adatta ai principianti
#6,119 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
angular, typescript
Ambito
frontend

Direzione di ricerca

Inizia da dynamic-onebox.component.ts, in particolare da DsDynamicOneboxComponent.onBlur(), e segui il percorso dell’evento blur fino a ds-dynamic-form-control-container e allo stato del FormControl. Riproduci il caso descritto con un campo onebox obbligatorio a vocabolario chiuso e testo senza corrispondenza. Il lavoro è completato quando, uscendo dal campo, viene mostrata un’indicazione visibile di non validità e il testo rifiutato non è più visualizzato, senza modificare il comportamento per i suggerimenti corrispondenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

affects: 10.x affects: 8.x affects: 9.x bug component: controlled vocabulary component: submission

Describe the bug

On a submission form field that uses a closed vocabulary (<vocabulary closed="true">) with the onebox input type, typing text without picking a suggestion gives the user no feedback at all. The typed text is never written to the FormControl, which is correct for a closed vocabulary, but nothing marks the field as invalid or touched either, so no error message and no invalid styling appears. If the field is also required, the user only finds out the value was rejected when they try to deposit.

Two things in DsDynamicOneboxComponent.onBlur() contribute:

  • when the typeahead suggestion list is open, the method calls event.preventDefault() and event.stopImmediatePropagation() and returns without this.blur.emit(event). The error message under the field is drawn by ds-dynamic-form-control-container, which only clears its focus state when a blur event reaches it, so the message stays hidden.
  • nothing ever calls markAsTouched() or sets an error on the control for the closed vocabulary case, so even after the field is left there is no invalid state to render.

I ran into this on DSpace-CRIS 2025.02, but onBlur in dynamic-onebox.component.ts is identical on main and dspace-9_x, and markAsTouched does not appear in that file on either branch, so it should apply there too. Browser was Chrome.

To Reproduce

  1. Configure a submission form field with input-type onebox, a <required> message, and <vocabulary closed="true">
  2. Start a submission and type some text into that field that does not match any vocabulary entry
  3. Wait for the suggestion list to appear, then click somewhere else on the form while it is still open
  4. The field shows no error message and no invalid styling. The typed text also stays in the box even though nothing was stored.

Expected behavior

Leaving a closed vocabulary field with text that was never matched to an entry should mark the field invalid and show the required error message, the same way any other required field does when it is left empty. The box should not keep showing text that was not stored.

Related work

Related to #4501 and #4502, but not the same path. Those cover the hierarchical vocabulary tree modal. This one is the typeahead suggestion list on a flat closed vocabulary, and #4502 does not add any control state handling.

We have a fix running locally against 2025.02 that flags the control and emits the blur only when a closed vocabulary violation was actually detected. Happy to open a PR against main if that direction is wanted.

Lingua principale
TypeScript
Stelle
180
Fork
577
Merge medio
2g 12h
PR unite (30g)
111

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DSpace/dspace-angular

Tutte le issue di DSpace/dspace-angular

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.