diff --git a/projects/igniteui-angular/src/lib/combo/combo.common.ts b/projects/igniteui-angular/src/lib/combo/combo.common.ts index dc91b183d2f..c357150c001 100644 --- a/projects/igniteui-angular/src/lib/combo/combo.common.ts +++ b/projects/igniteui-angular/src/lib/combo/combo.common.ts @@ -1206,15 +1206,15 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement this.searchValue = ''; if (!e.event) { this.comboInput?.nativeElement.focus(); + } else { + this._onTouchedCallback(); + this.updateValidity(); } } /** @hidden @internal */ public handleClosed() { this.closed.emit({ owner: this }); - if(this.comboInput.nativeElement !== document.activeElement){ - this.validateComboState(); - } } /** @hidden @internal */ @@ -1254,15 +1254,10 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement public onBlur() { if (this.collapsed) { this._onTouchedCallback(); - this.validateComboState(); + this.updateValidity(); } } - /** @hidden @internal */ - public onFocus(): void { - this._onTouchedCallback(); - } - /** @hidden @internal */ public setActiveDescendant(): void { this.activeDescendant = this.dropdown.focusedItem?.id || ''; @@ -1287,7 +1282,7 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement this.manageRequiredAsterisk(); }; - private validateComboState() { + private updateValidity() { if (this.ngControl && this.ngControl.invalid) { this.valid = IgxInputState.INVALID; } else { diff --git a/projects/igniteui-angular/src/lib/combo/combo.component.html b/projects/igniteui-angular/src/lib/combo/combo.component.html index ea5834c7b4a..a1cf5445d94 100644 --- a/projects/igniteui-angular/src/lib/combo/combo.component.html +++ b/projects/igniteui-angular/src/lib/combo/combo.component.html @@ -13,8 +13,7 @@ role="combobox" aria-haspopup="listbox" [attr.aria-expanded]="!dropdown.collapsed" [attr.aria-controls]="dropdown.listId" [attr.aria-labelledby]="ariaLabelledBy || label?.id || placeholder" - (blur)="onBlur()" - (focus)="onFocus()" /> + (blur)="onBlur()" /> diff --git a/projects/igniteui-angular/src/lib/combo/combo.component.spec.ts b/projects/igniteui-angular/src/lib/combo/combo.component.spec.ts index 34fcd5529d3..7688de6b93c 100644 --- a/projects/igniteui-angular/src/lib/combo/combo.component.spec.ts +++ b/projects/igniteui-angular/src/lib/combo/combo.component.spec.ts @@ -3425,7 +3425,8 @@ describe('igxCombo', () => { combo.open(); input.triggerEventHandler('focus', {}); fixture.detectChanges(); - expect(ngModel.touched).toBeTrue(); + expect(ngModel.touched).toBeFalse(); + fixture.detectChanges(); const documentClickEvent = new MouseEvent('click', { bubbles: true }); document.body.dispatchEvent(documentClickEvent); fixture.detectChanges();