Skip to content
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

Don't hide tooltip when pointer is over it. #13565

Merged
merged 5 commits into from
Nov 24, 2023

Conversation

grokys
Copy link
Member

@grokys grokys commented Nov 10, 2023

What does the pull request do?

As described in #8638, don't hide the tooltip for a control when the pointer moves over it.

What is the current behavior?

If a tooltip should be shown near the bounds of the screen, it won't appear. You can test this on the tooltip page in the control catalog.

What is the updated/expected behavior with this PR?

The tooltip stays open.

Checklist

  • Added unit tests (if possible)?

Fixed issues

Fixes #8638

@MrJul
Copy link
Member

MrJul commented Nov 11, 2023

Shouldn't the tooltip close when the mouse isn't over it anymore?
With this PR, the user has to move the mouse back from the tooltip to the original control, then out of it again for the tooltip to disappear.

@ltetak
Copy link
Contributor

ltetak commented Nov 23, 2023

I think this should solve this #13709

@grokys
Copy link
Member Author

grokys commented Nov 24, 2023

Shouldn't the tooltip close when the mouse isn't over it anymore?
With this PR, the user has to move the mouse back from the tooltip to the original control, then out of it again for the tooltip to disappear.

Good point. I guess if we go with this approach we need to check for the pointer exiting the tooltip and then close if it's over another control.

@MrJul not sure what you think of this approach vs #13709 ? I suspect that capturing the mouse to show a tooltip is going to break things.

@MrJul
Copy link
Member

MrJul commented Nov 24, 2023

Good point. I guess if we go with this approach we need to check for the pointer exiting the tooltip and then close if it's over another control.

Yes, I think that would solve the issue.

@MrJul not sure what you think of this approach vs #13709 ? I suspect that capturing the mouse to show a tooltip is going to break things.

I've commented on #13709: I agree with you, the capture approach is breaking things.

If the pointer has been moved from the control to the tooltip, then out of the tooltip to another control, ensure that the tooltip is closed.
@grokys
Copy link
Member Author

grokys commented Nov 24, 2023

@MrJul ok, pushed a fix for the pointer exiting the tooltip.

@MrJul
Copy link
Member

MrJul commented Nov 24, 2023

@MrJul ok, pushed a fix for the pointer exiting the tooltip.

I've tested the PR and it reacts exactly as I would expect :)

Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

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

LGTM!

@grokys grokys added this pull request to the merge queue Nov 24, 2023
Merged via the queue into master with commit 59d44e9 Nov 24, 2023
6 checks passed
@grokys grokys deleted the fixes/8638-pointer-over-tooltip branch November 24, 2023 14:58
@maxkatz6 maxkatz6 added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Nov 28, 2023
maxkatz6 pushed a commit that referenced this pull request Dec 5, 2023
* Add failing test for #8638.

* Don't hide tooltip when pointer is over tooltip.

Fixes #8638

* Close the tooltip when pointer exits.

If the pointer has been moved from the control to the tooltip, then out of the tooltip to another control, ensure that the tooltip is closed.

* AdornedControl can be a standard CLR property.
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Dec 5, 2023
@ltetak
Copy link
Contributor

ltetak commented Apr 5, 2024

Sorry for commenting on an old thread. This solution works great on Windows but does not work on macOS and probably does not work on Linux as well (#11179).
IsPointerOver is not set quickly enough and the tooltip does not have IsPointerOver set yet when the ControlPointerExited is invoked.
The problem is fundamentally in the order of two events: RawPointerEventType.LeaveWindow (for leaving the main window) and other events that activate the ToolTip popup window. The window is not activated immediately on mac. One needs to move the cursor above the window to get it activated. This delay causes the tooltip to be closed immediately.
I believe the solution would be to find some native event that would notify Avalonia layer ASAP when the window has been created and the mouse is over it without waiting for the mouse movement.
@grokys this works for me, can you check, please? #15251
Other platforms could use the same pattern

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.

ToolTip does not show when they would be over the taskbar or dock.
4 participants