Skip to content

Commit

Permalink
Merge pull request #16067 from Kisters-BS/fix/openPopupMenuOnNewTarget
Browse files Browse the repository at this point in the history
Fix popup menu cannot be opened on new target when already opened
  • Loading branch information
cetincakiroglu authored Jul 25, 2024
2 parents 62cde62 + b20e829 commit 743e36b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,16 @@ export class Menu implements OnDestroy {
* @group Method
*/
public show(event: any) {
if(this.visible && this.target !== event.currentTarget) {
this.hide()
}

this.target = event.currentTarget;
this.relativeAlign = event.relativeAlign;
this.visible = true;
this.preventDocumentDefault = true;
this.overlayVisible = true;
this.cd.markForCheck();
this.cd.detectChanges();
}

ngOnInit() {
Expand Down Expand Up @@ -466,6 +470,7 @@ export class Menu implements OnDestroy {
this.bindDocumentResizeListener();
this.bindScrollListener();
DomHandler.focus(this.listViewChild.nativeElement);
this.preventDocumentDefault = true;
}
break;

Expand Down Expand Up @@ -516,7 +521,7 @@ export class Menu implements OnDestroy {
public hide() {
this.visible = false;
this.relativeAlign = false;
this.cd.markForCheck();
this.cd.detectChanges();
}

onWindowResize() {
Expand Down Expand Up @@ -778,10 +783,6 @@ export class Menu implements OnDestroy {
this.unbindDocumentResizeListener();
this.unbindScrollListener();
this.preventDocumentDefault = false;

if (!(this.cd as ViewRef).destroyed) {
this.target = null;
}
}

ngOnDestroy() {
Expand Down

0 comments on commit 743e36b

Please sign in to comment.