Skip to content

Commit 10068c9

Browse files
authored
Merge pull request #5367 from IgniteUI/vslavov/enable-combo-checkbox
fix(combo): enable combo checkboxes
2 parents 5daa359 + 03be1f1 commit 10068c9

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<ng-container *ngIf="!isHeader">
2-
<igx-checkbox [checked]="selected" disableRipple="true" [disableTransitions]="disableTransitions" disabled="true" class="igx-combo__checkbox"></igx-checkbox>
2+
<igx-checkbox [checked]="selected" disableRipple="true" [disableTransitions]="disableTransitions" [tabindex]="-1" (click)="disableCheck($event)" class="igx-combo__checkbox"></igx-checkbox>
33
</ng-container>
44
<ng-content></ng-content>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ export class IgxComboItemComponent extends IgxDropDownItemComponent implements D
9999
this.comboAPI.set_selected_item(this.itemID, event);
100100
}
101101

102+
/**
103+
* @hidden
104+
* @internal
105+
* The event that is prevented is the click on the checkbox label element.
106+
* That is the only visible element that a user can interact with.
107+
* The click propagates to the host and the preventDefault is to stop it from
108+
* switching focus to the input it's base on.
109+
* The toggle happens in an internal handler in the drop-down on the next task queue cycle.
110+
*/
111+
disableCheck(event: MouseEvent) {
112+
event.preventDefault();
113+
}
114+
102115
ngDoCheck() {
103116
}
104117
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const CSS_CLASS_DROPDOWNBUTTON = 'igx-combo__toggle-button';
2929
const CSS_CLASS_CLEARBUTTON = 'igx-combo__clear-button';
3030
const CSS_CLASS_CHECK_GENERAL = 'igx-combo__checkbox';
3131
const CSS_CLASS_CHECKBOX = 'igx-checkbox';
32+
const CSS_CLASS_CHECKBOX_LABEL = 'igx-checkbox__composite';
3233
const CSS_CLASS_CHECKED = 'igx-checkbox--checked';
3334
const CSS_CLASS_TOGGLE = 'igx-toggle';
3435
const CSS_CLASS_SELECTED = 'igx-drop-down__item--selected';
@@ -950,7 +951,7 @@ describe('igxCombo', () => {
950951
}
951952
function clickItemCheckbox(dropdownElement: any, itemIndex: number) {
952953
const dropdownItems = dropdownElement.querySelectorAll('.' + CSS_CLASS_DROPDOWNLISTITEM);
953-
const checkbox = dropdownItems[itemIndex].querySelector('.' + CSS_CLASS_CHECKBOX) as HTMLElement;
954+
const checkbox = dropdownItems[itemIndex].querySelector('.' + CSS_CLASS_CHECKBOX_LABEL) as HTMLElement;
954955
checkbox.click();
955956
}
956957
function verifyItemIsSelected(

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_drop-down.scss

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
/// @prop {Map} hover-item-background [igx-color: 'surface', text-contrast: (), rgba: .04] - The drop-down hover item background color.
1717
/// @prop {Map} focused-item-background [igx-color: 'surface', text-contrast: (), rgba: .04] - The drop-down focused item background color.
1818
/// @prop {Map} focused-item-text-color [igx-color: 'surface', text-contrast: (), rgba: .74] - The drop-down focused item text color.
19-
/// @prop {Map} selected-item-background [igx-color: ('secondary', 500)] - The drop-down selected item background color.
20-
/// @prop {Map} selected-item-text-color [igx-contrast-color: ('secondary', 500)] - The drop-down selected item text color.
21-
/// @prop {Map} selected-hover-item-background [igx-color: ('secondary', 300)] - The drop-down selected item hover background color.
22-
/// @prop {Map} selected-hover-item-text-color [igx-contrast-color: ('secondary', 300)] - The drop-down selected item hover text color.
23-
/// @prop {Map} selected-focus-item-background [igx-color: ('secondary', 300)] - The drop-down selected item focus background color.
24-
/// @prop {Map} selected-focus-item-text-color [igx-contrast-color: ('secondary', 300)] - The drop-down selected item focus text color.
19+
/// @prop {Map} selected-item-background [igx-color: ('secondary', 100)] - The drop-down selected item background color.
20+
/// @prop {Map} selected-item-text-color [igx-contrast-color: ('secondary', 100)] - The drop-down selected item text color.
21+
/// @prop {Map} selected-hover-item-background [igx-color: ('secondary', 200)] - The drop-down selected item hover background color.
22+
/// @prop {Map} selected-hover-item-text-color [igx-contrast-color: ('secondary', 200)] - The drop-down selected item hover text color.
23+
/// @prop {Map} selected-focus-item-background [igx-color: ('secondary', 200)] - The drop-down selected item focus background color.
24+
/// @prop {Map} selected-focus-item-text-color [igx-contrast-color: ('secondary', 200)] - The drop-down selected item focus text color.
2525
/// @prop {Color} disabled-item-background [transparent] - The drop-down disabled item background color.
2626
/// @prop {Map} disabled-item-text-color [igx-color: 'surface', text-contrast: (), rgba: .38] - The drop-down disabled item text color.
2727
/// @prop {Number} elevation [8] - The elevation level, between 0-24, to be used for the badge shadow.
@@ -70,27 +70,27 @@ $_light-drop-down: extend(
7070
),
7171

7272
selected-item-background: (
73-
igx-color: ('secondary', 500)
73+
igx-color: ('secondary', 100),
7474
),
7575

7676
selected-item-text-color: (
77-
igx-contrast-color: ('secondary', 500)
77+
igx-contrast-color: ('secondary', 100)
7878
),
7979

8080
selected-hover-item-background: (
81-
igx-color: ('secondary', 300)
81+
igx-color: ('secondary', 200),
8282
),
8383

8484
selected-hover-item-text-color: (
85-
igx-contrast-color: ('secondary', 300)
85+
igx-contrast-color: ('secondary', 200)
8686
),
8787

8888
selected-focus-item-background: (
89-
igx-color: ('secondary', 300)
89+
igx-color: ('secondary', 200),
9090
),
9191

9292
selected-focus-item-text-color: (
93-
igx-contrast-color: ('secondary', 300)
93+
igx-contrast-color: ('secondary', 200)
9494
),
9595

9696
disabled-item-background: transparent,

0 commit comments

Comments
 (0)