Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autocomplete updateOn blur on select (#16805) #16828

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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