Skip to content

Commit

Permalink
Merge pull request #16107 from primefaces/issue-16106
Browse files Browse the repository at this point in the history
Fixed #16106 - Password | Tooltip with tooltipEvent='focus' is never …
  • Loading branch information
cetincakiroglu authored Aug 1, 2024
2 parents 4016d6d + 9ae775f commit 9eee5df
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/app/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,7 @@ export class Tooltip implements AfterViewInit, OnDestroy {
this.focusListener = this.onFocus.bind(this);
this.blurListener = this.onBlur.bind(this);

let target = this.el.nativeElement.querySelector('.p-component');

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

target.addEventListener('focus', this.focusListener);
target.addEventListener('blur', this.blurListener);
Expand Down Expand Up @@ -605,7 +601,7 @@ export class Tooltip implements AfterViewInit, OnDestroy {
}

getTarget(el: Element) {
return DomHandler.hasClass(el, 'p-inputwrapper') ? DomHandler.findSingle(el, 'input') : el;
return DomHandler.hasClass(el, 'p-inputwrapper') ? DomHandler.findSingle(el, 'input') : el.querySelector('.p-component') || el;
}

preAlign(position: string) {
Expand Down Expand Up @@ -672,11 +668,9 @@ export class Tooltip implements AfterViewInit, OnDestroy {
this.el.nativeElement.removeEventListener('click', this.clickListener);
}
if (tooltipEvent === 'focus' || tooltipEvent === 'both') {
let target = this.el.nativeElement.querySelector('.p-component');

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

let target = this.getTarget(this.el.nativeElement);


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

0 comments on commit 9eee5df

Please sign in to comment.