Skip to content

Commit

Permalink
Merge pull request #14749 from primefaces/issue-14442
Browse files Browse the repository at this point in the history
Fixed #14442 - Multiselect | double click on multiselect button cause…
  • Loading branch information
cetincakiroglu authored Feb 7, 2024
2 parents 652df0c + 579033f commit fa28508
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft

selectedOptions: any;

clickInProgress : boolean = false;

get containerClass() {
return {
'p-multiselect p-component p-inputwrapper': true,
Expand Down Expand Up @@ -1692,14 +1694,24 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
}

onContainerClick(event: any) {
if (this.disabled || this.readonly || (<Node>event.target).isSameNode(this.focusInputViewChild?.nativeElement)) {
if (this.disabled || this.readonly || (event.target as Node).isSameNode(this.focusInputViewChild?.nativeElement)) {
return;
}

if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.closest('[data-pc-section="clearicon"]')) {
event.preventDefault();
return;
} else if (!this.overlayViewChild || !this.overlayViewChild.el.nativeElement.contains(event.target)) {
if (this.clickInProgress) {
return;
}

this.clickInProgress = true;

setTimeout(() => {
this.clickInProgress = false;
}, 150);

this.overlayVisible ? this.hide(true) : this.show(true);
}
this.focusInputViewChild?.nativeElement.focus({ preventScroll: true });
Expand Down

0 comments on commit fa28508

Please sign in to comment.