Skip to content

Commit

Permalink
Fixed #15472 -Tooltip | Tooltip-option tooltipEvent=focus does not wo…
Browse files Browse the repository at this point in the history
…rk on p-button
  • Loading branch information
mehmetcetin01140 committed May 7, 2024
1 parent 665ce7b commit 1346fa2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ export class Tooltip implements AfterViewInit, OnDestroy {
this.focusListener = this.onFocus.bind(this);
this.blurListener = this.onBlur.bind(this);

let target = this.getTarget(this.el.nativeElement);
let target = this.el.nativeElement.querySelector('.p-component');
if (!target) {
target = this.el.nativeElement;
}

target.addEventListener('focus', this.focusListener);
target.addEventListener('blur', this.blurListener);
}
Expand Down Expand Up @@ -638,7 +642,11 @@ export class Tooltip implements AfterViewInit, OnDestroy {
this.el.nativeElement.removeEventListener('mouseleave', this.mouseLeaveListener);
this.el.nativeElement.removeEventListener('click', this.clickListener);
} else if (this.getOption('tooltipEvent') === 'focus') {
let target = this.getTarget(this.el.nativeElement);
let target = this.el.nativeElement.querySelector('.p-component');

if (!target) {
target = this.el.nativeElement;
}

target.removeEventListener('focus', this.focusListener);
target.removeEventListener('blur', this.blurListener);
Expand Down Expand Up @@ -703,3 +711,4 @@ export class Tooltip implements AfterViewInit, OnDestroy {
declarations: [Tooltip]
})
export class TooltipModule {}

0 comments on commit 1346fa2

Please sign in to comment.