Skip to content

Fix HoverCard tooltip clipping in the Flutter Inspector#9823

Merged
auto-submit[bot] merged 14 commits intoflutter:masterfrom
kenzieschmoll:fix-3920-tooltip-clipping
May 8, 2026
Merged

Fix HoverCard tooltip clipping in the Flutter Inspector#9823
auto-submit[bot] merged 14 commits intoflutter:masterfrom
kenzieschmoll:fix-3920-tooltip-clipping

Conversation

@kenzieschmoll
Copy link
Copy Markdown
Member

Prevents hover tooltips from being clipped by the window edges by implementing proper clamping and positioning logic in HoverCard.

Fixes #3920

Prevents hover tooltips from being clipped by the window edges by implementing
proper clamping and positioning logic in `HoverCard`.

Fixes flutter#3920
@kenzieschmoll kenzieschmoll requested a review from a team as a code owner May 7, 2026 16:47
@kenzieschmoll kenzieschmoll requested review from bkonyi and removed request for a team May 7, 2026 16:47
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves hover card positioning by refactoring the offset calculation into a dedicated method and adding boundary clamping to prevent overflow and clipping. It also introduces comprehensive widget tests to verify positioning at window edges and in small viewports. The review feedback identifies issues with the vertical clamping logic in both the new _calculateCursorPosition method and the existing tooltip state, suggesting a more robust and simplified approach using clamp and math.max to ensure the tooltip remains within the top margin.

Comment thread packages/devtools_app/lib/src/shared/ui/hover.dart Outdated
Comment thread packages/devtools_app/lib/src/shared/ui/hover.dart Outdated
@kenzieschmoll
Copy link
Copy Markdown
Member Author

/gemini review again

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where hover tooltips in the widget tree were being clipped by window boundaries. It introduces a more robust positioning logic for HoverCard by calculating the available space within the overlay and clamping the card's position accordingly. New constants were added to account for the total height of the card, including the title and divider. Additionally, comprehensive tests were added to verify the positioning logic in various scenarios. Feedback points out a potential issue with global coordinate usage when DevTools is embedded and suggests making the height calculation dynamic to avoid unnecessary gaps when a title is absent.

Comment thread packages/devtools_app/lib/src/shared/ui/hover.dart
Comment thread packages/devtools_app/lib/src/shared/ui/hover.dart Outdated
@kenzieschmoll kenzieschmoll requested a review from srawlins May 7, 2026 22:49
Copy link
Copy Markdown
Contributor

@srawlins srawlins left a comment

Choose a reason for hiding this comment

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

Great tests!

Comment thread packages/devtools_app/test/shared/ui/hover_positioning_test.dart
@kenzieschmoll kenzieschmoll added the autosubmit Merge PR when tree becomes green via auto submit App label May 8, 2026
@auto-submit auto-submit Bot merged commit 24fba28 into flutter:master May 8, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspector: Hover on widget tree, tooltip is clipped by the window

2 participants