Invalidate tooltips when mouse leaves element's hitbox (cherry-pick #22488) #22489
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.
Cherry-picked Invalidate tooltips when mouse leaves element's hitbox (#22488)
Closes #21657
In case of the task rerun button tooltip from
zed/crates/terminal_view/src/terminal_view.rs
Lines 1051 to 1070 in f6dabad
, the actual button element is not styled as invisible, only its parent.
Zed won't render such element since it's parent is hidden, but will
consider it "visible" all the time its
paint
is called, spawning atask with the delay, that will create the tooltip:
zed/crates/gpui/src/elements/div.rs
Lines 1949 to 1959 in f6dabad
When the parent is hidden, the child won't be painted anymore, and no
mouse listeners will be able to detect this fact and hide the tooltip.
Hence, check such cases separately, during
prepaint
, and invalidatethe tooltips that are not valid anymore.
We cannot use
hitbox.is_hovered(cx)
as it's not really hovered duringprepaint, so a mouse position check is used instead.
Release Notes: