-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalidate tooltips when mouse leaves element's hitbox #22488
Merged
Merged
Conversation
This file contains 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
cla-bot
bot
added
the
cla-signed
The user has signed the Contributor License Agreement
label
Dec 29, 2024
/cherry-pick v0.167.x |
gcp-cherry-pick-bot bot
pushed a commit
that referenced
this pull request
Dec 29, 2024
Closes #21657 In case of the task rerun button tooltip from https://github.com/zed-industries/zed/blob/f6dabadaf79bd29c89c8d55a1e9f1d33236f736e/crates/terminal_view/src/terminal_view.rs#L1051-L1070 , 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 a task with the delay, that will create the tooltip: https://github.com/zed-industries/zed/blob/f6dabadaf79bd29c89c8d55a1e9f1d33236f736e/crates/gpui/src/elements/div.rs#L1949-L1959 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 invalidate the tooltips that are not valid anymore. We cannot use `hitbox.is_hovered(cx)` as it's not really hovered during prepaint, so a mouse position check is used instead. Release Notes: - Fixed tooltips getting stuck
SomeoneToIgnore
added a commit
that referenced
this pull request
Dec 29, 2024
…22488) (#22489) Cherry-picked Invalidate tooltips when mouse leaves element's hitbox (#22488) Closes #21657 In case of the task rerun button tooltip from https://github.com/zed-industries/zed/blob/f6dabadaf79bd29c89c8d55a1e9f1d33236f736e/crates/terminal_view/src/terminal_view.rs#L1051-L1070 , 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 a task with the delay, that will create the tooltip: https://github.com/zed-industries/zed/blob/f6dabadaf79bd29c89c8d55a1e9f1d33236f736e/crates/gpui/src/elements/div.rs#L1949-L1959 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 invalidate the tooltips that are not valid anymore. We cannot use `hitbox.is_hovered(cx)` as it's not really hovered during prepaint, so a mouse position check is used instead. Release Notes: - Fixed tooltips getting stuck Co-authored-by: Kirill Bulatov <kirill@zed.dev>
SomeoneToIgnore
added a commit
that referenced
this pull request
Jan 1, 2025
This reverts commit 344284e.
1 task
SomeoneToIgnore
added a commit
that referenced
this pull request
Jan 1, 2025
…" (cherry-pick #22542) (#22544) Cherry-picked Revert "Invalidate tooltips when mouse leaves element's hitbox (#22488)" (#22542) This reverts commit 344284e. That change broke git blame tooltips, as Zed should also show tooltips which are hovered, even though the mouse had left the origin element's bounds. Release Notes: - N/A Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Merged
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 1, 2025
Closes #21657 Follow-up of #22488 Previous PR broke git blame tooltips, which are expected to be open when hovered, even if the mouse cursor is moved away from the actual blame entry that caused the tooltip to appear. Current version moves the invalidation logic into `prepaint_tooltip`, where the new data about the tooltip origin is used to ensure we invalidate only tooltips that have no mouse cursor in either origin bounds or tooltip bounds (if it's hoverable). Release Notes: - Fixed tooltips getting stuck
gcp-cherry-pick-bot bot
pushed a commit
that referenced
this pull request
Jan 1, 2025
Closes #21657 Follow-up of #22488 Previous PR broke git blame tooltips, which are expected to be open when hovered, even if the mouse cursor is moved away from the actual blame entry that caused the tooltip to appear. Current version moves the invalidation logic into `prepaint_tooltip`, where the new data about the tooltip origin is used to ensure we invalidate only tooltips that have no mouse cursor in either origin bounds or tooltip bounds (if it's hoverable). Release Notes: - Fixed tooltips getting stuck
gcp-cherry-pick-bot bot
pushed a commit
that referenced
this pull request
Jan 1, 2025
Closes #21657 Follow-up of #22488 Previous PR broke git blame tooltips, which are expected to be open when hovered, even if the mouse cursor is moved away from the actual blame entry that caused the tooltip to appear. Current version moves the invalidation logic into `prepaint_tooltip`, where the new data about the tooltip origin is used to ensure we invalidate only tooltips that have no mouse cursor in either origin bounds or tooltip bounds (if it's hoverable). Release Notes: - Fixed tooltips getting stuck
helgemahrt
pushed a commit
to helgemahrt/zed
that referenced
this pull request
Jan 1, 2025
…s#22488) Closes zed-industries#21657 In case of the task rerun button tooltip from https://github.com/zed-industries/zed/blob/f6dabadaf79bd29c89c8d55a1e9f1d33236f736e/crates/terminal_view/src/terminal_view.rs#L1051-L1070 , 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 a task with the delay, that will create the tooltip: https://github.com/zed-industries/zed/blob/f6dabadaf79bd29c89c8d55a1e9f1d33236f736e/crates/gpui/src/elements/div.rs#L1949-L1959 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 invalidate the tooltips that are not valid anymore. We cannot use `hitbox.is_hovered(cx)` as it's not really hovered during prepaint, so a mouse position check is used instead. Release Notes: - Fixed tooltips getting stuck
SomeoneToIgnore
added a commit
that referenced
this pull request
Jan 1, 2025
Cherry-picked Remove stuck tooltips (#22548) Closes #21657 Follow-up of #22488 Previous PR broke git blame tooltips, which are expected to be open when hovered, even if the mouse cursor is moved away from the actual blame entry that caused the tooltip to appear. Current version moves the invalidation logic into `prepaint_tooltip`, where the new data about the tooltip origin is used to ensure we invalidate only tooltips that have no mouse cursor in either origin bounds or tooltip bounds (if it's hoverable). Release Notes: - Fixed tooltips getting stuck Co-authored-by: Kirill Bulatov <kirill@zed.dev>
SomeoneToIgnore
added a commit
that referenced
this pull request
Jan 1, 2025
Cherry-picked Remove stuck tooltips (#22548) Closes #21657 Follow-up of #22488 Previous PR broke git blame tooltips, which are expected to be open when hovered, even if the mouse cursor is moved away from the actual blame entry that caused the tooltip to appear. Current version moves the invalidation logic into `prepaint_tooltip`, where the new data about the tooltip origin is used to ensure we invalidate only tooltips that have no mouse cursor in either origin bounds or tooltip bounds (if it's hoverable). Release Notes: - Fixed tooltips getting stuck Co-authored-by: Kirill Bulatov <kirill@zed.dev>
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.
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 a task 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 invalidate the tooltips that are not valid anymore.We cannot use
hitbox.is_hovered(cx)
as it's not really hovered during prepaint, so a mouse position check is used instead.Release Notes: