Repository navigation
tooltip: Keep a pressed trigger's tooltip dismissed until the pointer leaves - #3492
Merged
madcodelife merged 3 commits intoOct 13, 2026
Merged
Conversation
… leaves A trigger's mouse-down hid its tooltip, but the next hover-enter could request it again while the pointer never left. When the click removes the trigger (a button that replaces its view), a pointer move dispatched before the next frame still hits the old frame, where the trigger is hovered, so the tooltip was requested again. The trigger is gone from the next frame, no hover-leave ever follows, and the tooltip appeared after the show delay and stayed until another trigger replaced it. A press now records the trigger's bounds in the window state, and the trigger does not request its tooltip again until a hover-leave arrives with the pointer outside it, matching native controls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019wKm1jXcvgRzuLoXfj1jMf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Thanks. |
madcodelife
enabled auto-merge (squash)
October 13, 2026 14:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A managed tooltip (
Button::tooltipand the other components that useManagedTooltipExt) can stay on screen for good after a click removes its trigger, for example a button that replaces the view it sits in. Only another tooltip trigger can replace it.Steps:
The mouse-down hides the tooltip, and the pointer stays on the button the whole time. GPUI reports hover as
falsewhile the button is held. The move right after the release is dispatched to the frame that was already drawn, where the button is still hovered, soon_hover(true)fires and the tooltip is requested again. The click has already removed the button, so the next frame doesn't contain it and no hover-leave ever follows. After the show delay, the tooltip appears at the button's old bounds and stays.Fix
A press now keeps the trigger's tooltip dismissed until the pointer actually leaves the trigger, which is how native macOS and Windows controls behave. The trigger's bounds are recorded on mouse-down in the per-window
WindowState. While they are recorded, a hover-enter on that trigger requests nothing. A hover-leave clears them only when the pointer is outside the trigger, because hover also reportsfalsewhile the button is held.The change is confined to
crates/component(tooltip.rs,root.rs).gpui-baseis untouched.Public API
None. The new field on
WindowStateispub(crate).Tests
Two tests in
crates/component/src/tooltip.rs:clicking_a_trigger_away_does_not_leave_its_tooltipreproduces the bug. It dispatches the release and the move in one update so that no frame is drawn between them, as happens in a real event loop; the test platform otherwise draws a dirty window after every simulated event. It fails without the fix.a_press_dismisses_the_tooltip_until_the_pointer_leaves: after a click on a trigger that stays, the tooltip doesn't come back while the pointer stays on it, and does come back after the pointer leaves and returns.cargo test -p gpui-component --libpasses (667 tests), andcargo clippy -p gpui-component --all-targets -- --deny warningsandcargo fmt --checkare clean.Found in an application built on gpui-kit 0.6.6, where the bug was reproduced with real OS mouse events. The code is the same in 0.7.x and on
main.🤖 Generated with Claude Code
https://claude.ai/code/session_019wKm1jXcvgRzuLoXfj1jMf