Skip to content

Commit e8ec5b8

Browse files
committed
fix(dropdown): disallow clicking an item again to clear it
1 parent 24bc4de commit e8ec5b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dropdown/list/dropdown-list.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,16 @@ export class DropdownList implements AbstractDropdownView, AfterViewInit, OnChan
384384
*/
385385
doClick(event, item) {
386386
if (!item.disabled) {
387-
item.selected = !item.selected;
388387
if (this.type === "single") {
388+
item.selected = true;
389389
// reset the selection
390390
for (let otherItem of this.items) {
391391
if (item !== otherItem) { otherItem.selected = false; }
392392
}
393393

394394
this.select.emit({item});
395395
} else {
396+
item.selected = !item.selected;
396397
// emit an array of selected items
397398
this.select.emit(this.getSelected());
398399
}

0 commit comments

Comments
 (0)