From ff394b26da90821e6874d46f76a8b3e20c4ea405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:37:01 +0300 Subject: [PATCH] Fixed #15714 - pTree: right click on treenode chevron down --- src/app/components/tree/tree.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/components/tree/tree.ts b/src/app/components/tree/tree.ts index 3a4f784e344..758e16f6a94 100755 --- a/src/app/components/tree/tree.ts +++ b/src/app/components/tree/tree.ts @@ -1155,12 +1155,7 @@ export class Tree implements OnInit, AfterContentInit, OnChanges, OnDestroy, Blo public dragStopSubscription: Subscription | undefined | null; - constructor( - public el: ElementRef, - @Optional() public dragDropService: TreeDragDropService, - public config: PrimeNGConfig, - private cd: ChangeDetectorRef - ) {} + constructor(public el: ElementRef, @Optional() public dragDropService: TreeDragDropService, public config: PrimeNGConfig, private cd: ChangeDetectorRef) {} ngOnInit() { if (this.droppableNodes) { @@ -1374,8 +1369,14 @@ export class Tree implements OnInit, AfterContentInit, OnChanges, OnDestroy, Blo onNodeRightClick(event: MouseEvent, node: TreeNode) { if (this.contextMenu) { let eventTarget = event.target; + let className; - if (eventTarget.className && eventTarget.className.indexOf('p-tree-toggler') === 0) { + if (eventTarget instanceof SVGElement) { + className = eventTarget.getAttribute('class'); + } else { + className = eventTarget.className; + } + if (className && className.indexOf('p-tree-toggler') === 0) { return; } else { let index = this.findIndexInSelection(node);