Skip to content

Commit

Permalink
Fixed #14788 - update select condition to prevent selection of alread…
Browse files Browse the repository at this point in the history
…y selected item
  • Loading branch information
cetincakiroglu committed Feb 14, 2024
1 parent 469466a commit 92e3310
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,13 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
}

onOptionSelect(event, option, isHide = true, preventChange = false) {
const value = this.getOptionValue(option);
this.updateModel(value, event);
this.focusedOptionIndex.set(this.findSelectedOptionIndex());
isHide && setTimeout(() => this.hide(true), 1);
preventChange === false && this.onChange.emit({ originalEvent: event, value: value });
if (!this.isSelected(option)) {
const value = this.getOptionValue(option);
this.updateModel(value, event);
this.focusedOptionIndex.set(this.findSelectedOptionIndex());
isHide && setTimeout(() => this.hide(true), 1);
preventChange === false && this.onChange.emit({ originalEvent: event, value: value });
}
}

onOptionMouseEnter(event, index) {
Expand Down

0 comments on commit 92e3310

Please sign in to comment.