diff --git a/src/app/components/tooltip/tooltip.ts b/src/app/components/tooltip/tooltip.ts index f623e528f9c..4b78e5d311b 100755 --- a/src/app/components/tooltip/tooltip.ts +++ b/src/app/components/tooltip/tooltip.ts @@ -185,7 +185,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.getTarget(this.el.nativeElement); + } target.addEventListener('focus', this.focusListener); target.addEventListener('blur', this.blurListener); @@ -601,7 +605,7 @@ export class Tooltip implements AfterViewInit, OnDestroy { } getTarget(el: Element) { - return DomHandler.hasClass(el, 'p-inputwrapper') ? DomHandler.findSingle(el, 'input') : el.querySelector('.p-component') || el; + return DomHandler.hasClass(el, 'p-inputwrapper') ? DomHandler.findSingle(el, 'input') : el; } preAlign(position: string) { @@ -668,10 +672,11 @@ 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'); - target.removeEventListener('focus', this.focusListener); - target.removeEventListener('blur', this.blurListener); + if (!target) { + target = this.getTarget(this.el.nativeElement); + } } this.unbindDocumentResizeListener(); }