Skip to content

Commit 0e69f23

Browse files
authored
Merge pull request #7826 from IgniteUI/mkirova/fix-7778-9.1.x
fix(igxCombo): Prevent toggle on click of disabled combo.
2 parents 551fb84 + 84d24be commit 0e69f23

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,13 @@ describe('igxCombo', () => {
24612461
expect(combo.valid).toEqual(IgxComboState.INITIAL);
24622462
expect(combo.comboInput.valid).toEqual(IgxInputState.INITIAL);
24632463
});
2464+
it('should not open on click if combo is disabled', () => {
2465+
combo.disabled = true;
2466+
fixture.detectChanges();
2467+
UIInteractions.simulateClickEvent(combo.comboInput.nativeElement);
2468+
fixture.detectChanges();
2469+
expect(combo.dropdown.collapsed).toBeTruthy();
2470+
});
24642471
it('should be possible to be enabled/disabled when used as a form control', () => {
24652472
const form = fixture.componentInstance.reactiveForm;
24662473
const comboFormReference = form.controls.townCombo;

projects/igniteui-angular/src/lib/combo/combo.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,9 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
874874
onInputClick(event: Event) {
875875
event.stopPropagation();
876876
event.preventDefault();
877-
this.toggle();
877+
if (!this.disabled) {
878+
this.toggle();
879+
}
878880
}
879881

880882
/**

0 commit comments

Comments
 (0)