Skip to content

Commit

Permalink
Merge pull request #15587 from primefaces/issue-15390
Browse files Browse the repository at this point in the history
Fixed #15390 - Button/p-button and tooltip: Doesn't work correctly
  • Loading branch information
cetincakiroglu authored May 16, 2024
2 parents 9e76231 + 7ea8741 commit 5d52398
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/app/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,19 @@ export class Tooltip implements AfterViewInit, OnDestroy {

alignRight() {
this.preAlign('right');
let hostOffset = this.getHostOffset();
let left = hostOffset.left + DomHandler.getOuterWidth(this.el.nativeElement);
let top = hostOffset.top + (DomHandler.getOuterHeight(this.el.nativeElement) - DomHandler.getOuterHeight(this.container)) / 2;
const el = this.activeElement;

const hostOffset = this.getHostOffset();
const left = hostOffset.left + DomHandler.getOuterWidth(el);
const top = hostOffset.top + (DomHandler.getOuterHeight(el) - DomHandler.getOuterHeight(this.container)) / 2;
this.container.style.left = left + this.getOption('positionLeft') + 'px';
this.container.style.top = top + this.getOption('positionTop') + 'px';
}

private get activeElement(): HTMLElement {
return this.el.nativeElement.nodeName.includes('P-') ? DomHandler.findSingle(this.el.nativeElement, '.p-component') : this.el.nativeElement;
}

alignLeft() {
this.preAlign('left');
let hostOffset = this.getHostOffset();
Expand Down

0 comments on commit 5d52398

Please sign in to comment.