Skip to content

fix: transaction details tooltip (#6292)#6329

Open
OscarG673 wants to merge 3 commits intomempool:masterfrom
OscarG673:fix-tooltip-block
Open

fix: transaction details tooltip (#6292)#6329
OscarG673 wants to merge 3 commits intomempool:masterfrom
OscarG673:fix-tooltip-block

Conversation

@OscarG673
Copy link
Copy Markdown
Contributor

@OscarG673 OscarG673 commented Feb 18, 2026

Summary

the transaction details tooltip in the block overview sometimes jumped when moving the mouse. This happened mainly when the tooltip had more properties, meaning when the content was taller or wider

Results

the tooltip stops jumping when it has more properties: the position is adjusted only once after the layout, using the correct size, and then it follows the cursor using the same logic,

result video:
https://github.com/user-attachments/assets/2a0f306d-1cb0-41d5-a5ed-c0f037042e0f

fixes: #6292

Copilot AI review requested due to automatic review settings February 18, 2026 21:57
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Feb 18, 2026

Thanks for your contribution to The Mempool Open Source Project. We require all contributors to agree to our Contributor License Agreement and don't seem to have one for you on file. Please see the instructions in CONTRIBUTING.md to proceed with this pull request.

@OscarG673 OscarG673 changed the title fix: transaction details tooltip (#5917) fix: transaction details tooltip (#6292) Feb 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes tooltip “jumping” in the block overview transaction details by separating cursor-following updates from a one-time post-layout size-aware position adjustment.

Changes:

  • Refactors tooltip positioning into a reusable updatePosition() method.
  • Adds a requestAnimationFrame-based schedulePositionAfterLayout() to update position once after the tooltip’s content/layout changes.

Comment on lines +112 to +120
schedulePositionAfterLayout(): void {
if (this.positionRafId != null) cancelAnimationFrame(this.positionRafId);
this.positionRafId = requestAnimationFrame(() => {
this.positionRafId = null;
if (this.tx && this.cursorPosition && this.tooltipElement?.nativeElement?.offsetParent) {
this.updatePosition();
this.cd.markForCheck();
}
});
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schedulePositionAfterLayout() schedules a requestAnimationFrame callback that can still fire after the component is destroyed (e.g., tooltip disappears on hover-out), which may call markForCheck() on a destroyed view. Implement OnDestroy and cancel any pending RAF id (and null it) in ngOnDestroy() to avoid leaks and potential change-detection errors.

Copilot uses AI. Check for mistakes.
@mononaut
Copy link
Copy Markdown
Contributor

this seems to improve the jumping a bit, but introduces a lateral shaking effect instead:

Screen.Recording.2026-02-19.at.6.20.34.AM.mov

@cla-bot cla-bot bot added the cla-signed label Feb 25, 2026
@OscarG673
Copy link
Copy Markdown
Contributor Author

this seems to improve the jumping a bit, but introduces a lateral shaking effect instead:

Screen.Recording.2026-02-19.at.6.20.34.AM.mov

thanks for the feedback @mononaut.
that lateral shaking issue has been resolved in the last commit.

new.mov

Copy link
Copy Markdown
Contributor

@mononaut mononaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much smoother!

just a few minor issues to address

this.pendingPositionRecalc = false;
requestAnimationFrame(() => {
this.updateTooltipPosition(this.cursorPosition, true);
this.appRef.tick();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.appRef.tick() is overkill here, this.cd.detectChanges(); should be sufficient

Suggested change
this.appRef.tick();
this.cd.detectChanges();

}


ngAfterViewChecked(): void {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise, running these checks in ngAfterViewChecked() is excessive (it'll run on every change detection cycle across the whole application).

it should be fine to make this a simple class method and invoke it explicitly from inside ngOnChanges (when we know something relevant has actually changed)

and then you probably don't need the pendingPositionRecalc field either.

Suggested change
ngAfterViewChecked(): void {
private schedulePositionRecalc(): void {

Comment on lines +39 to +41



Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a lot of stray newlines everywhere, please remove

} else {
y = maxYInParent;
}
y = Math.min(y, maxYInParent);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems redundant? I don't think it's possible for y to be greater than maxYInParent by this point

Suggested change
y = Math.min(y, maxYInParent);

@OscarG673
Copy link
Copy Markdown
Contributor Author

much smoother!

just a few minor issues to address

thank you for the feedback, @mononaut.

i have implemented the suggested changes in block-overview-tooltip.component.ts and verified them locally.

Please let me know if there's anything else to adjust!

private schedulePositionRecalc(): void {
requestAnimationFrame(() => {
this.updateTooltipPosition(this.cursorPosition, true);
this.appRef.tick();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we're still using appRef.tick() - did it not work properly with cd.detectChanges() instead?

@@ -1,4 +1,4 @@
import { Component, ElementRef, ViewChild, Input, OnChanges, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { Component, ElementRef, ViewChild, Input, OnChanges, AfterViewChecked, ChangeDetectorRef, ApplicationRef } from '@angular/core';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AfterViewChecked is no longer used

@nymkappa nymkappa requested a review from mononaut March 14, 2026 11:19
@orangesurf orangesurf added this to the v3.4.0 milestone Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI] transaction details tooltip in block overview sometimes jumps

4 participants