Skip to content

Commit 3a206b8

Browse files
authored
Merge pull request #7824 from IgniteUI/mkirova/fix-7778
fix(igxCombo): Prevent toggle on click of disabled combo.
2 parents 7efa0ad + 3a710aa commit 3a206b8

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
@@ -873,7 +873,9 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
873873
onInputClick(event: Event) {
874874
event.stopPropagation();
875875
event.preventDefault();
876-
this.toggle();
876+
if (!this.disabled) {
877+
this.toggle();
878+
}
877879
}
878880

879881
/**

0 commit comments

Comments
 (0)