Skip to content

Commit

Permalink
Fix autocomplete updateOn blur on select (primefaces#16805)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeederX committed Nov 24, 2024
1 parent cb341b8 commit b052770
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,11 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
this.dirty = false;
this.focused = false;
this.focusedOptionIndex.set(-1);
this.onModelTouched();
/** triggered only if user can input freely text
* Later on it must set touched also onSelect */
if(!this.forceSelection){
this.onModelTouched();
}
this.onBlur.emit(event);
}

Expand Down Expand Up @@ -1446,6 +1450,9 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
this.updateModel(value);
}

/** triggers model touched to update FormControl
* value in case updateOn is set to "blur" */
this.onModelTouched();
this.onSelect.emit({ originalEvent: event, value: option });

isHide && this.hide(true);
Expand Down

0 comments on commit b052770

Please sign in to comment.