Skip to content

Commit

Permalink
Merge pull request #15473 from primefaces/issue-15472
Browse files Browse the repository at this point in the history
Fixed #15472 -Tooltip | Tooltip-option tooltipEvent=focus does not wo…
  • Loading branch information
cetincakiroglu authored May 9, 2024
2 parents 4560b83 + 8b42eed commit d48f08a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ 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.getTarget(this.el.nativeElement);
}

target.addEventListener('focus', this.focusListener);
target.addEventListener('blur', this.blurListener);
}
Expand Down Expand Up @@ -648,12 +653,15 @@ export class Tooltip implements AfterViewInit, OnDestroy {
this.el.nativeElement.removeEventListener('click', this.clickListener);
}
if (tooltipEvent === 'focus' || tooltipEvent === 'both') {
let target = this.getTarget(this.el.nativeElement);
let target = this.el.nativeElement.querySelector('.p-component');

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

target.removeEventListener('focus', this.focusListener);
target.removeEventListener('blur', this.blurListener);
}

this.unbindDocumentResizeListener();
}

Expand Down

0 comments on commit d48f08a

Please sign in to comment.