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

Tooltips are not displayed after capturing/releasing pointer #9222

Closed
jeremy-visionaid opened this issue Jan 11, 2024 · 3 comments
Closed

Tooltips are not displayed after capturing/releasing pointer #9222

jeremy-visionaid opened this issue Jan 11, 2024 · 3 comments
Labels
area-ToolTip bug Something isn't working needs-triage Issue needs to be triaged by the area owners team-Controls Issue for the Controls team

Comments

@jeremy-visionaid
Copy link

Describe the bug

Tooltips are not displayed after capturing/releasing pointer

Steps to reproduce the bug

  1. Capture a pointer with CapturePointer
  2. Release it ReleasePointerCaptures

Tooltips are then not displayed on mouse over

Repro repo available at:
https://github.com/molesmoke/WinUITestApp/tree/tooltip

Expected behavior

Tooltips should continue to be displayed on mouse over

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5 Experimental 1: 1.5.231202003-experimental1

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@jeremy-visionaid jeremy-visionaid added the bug Something isn't working label Jan 11, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 11, 2024
@bpulliam bpulliam added area-ToolTip team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 18, 2024
@ranjeshj
Copy link
Contributor

The tooltip does not work even without any of the capture code. The problem is that the TextBlock you have in the Grid is on 'top' of the button. You can try using a stack panel or rows/columns in grid to make sure mouse events go to the button.

 <Grid x:Name="grid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
     <Button ToolTipService.ToolTip="Tooltip">Hello</Button>
     <TextBlock>Test</TextBlock>
 </Grid>

@ranjeshj ranjeshj closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@JJBrychell
Copy link

A little more explanation. Many controls attempt to fill a grid cell (if they are contained withing a grid). TextBlock is one of those controls. We can debate whether it should or not, but currently it does. So when you place the TextBlock after the Button in the markup, it will overlay the whole grid cell, covering the button. That you can see the button through the background of the TextBlock is beside the point. Some other things to notice is you aren't getting the pointer effects (e.g. pressed and released states) and the click event doesn't fire. This is because the text block is getting these events. Also, if you add a tooltip to the text block, it will show up even when you are hovering over the button.

Couple of ways to fix this.

  1. Change the layout so that the TextBlock does not take the full grid cell (e.g. Horizontal and/or vertical alignment is something other than stretch, a MaxLine property or an explicit size).
  2. Swap position of the Button and TextBlock so the Button sits on top of the TextBlock.

@jeremy-visionaid
Copy link
Author

Thanks, I was trying to reproduce a bug in a MAUI Windows app where tooltips stop appearing after a while. The TextBlock wasn't really relevant to my case, just accidentally staged while trying to come up with a minimal repro to determine if the behaviour I was seeing was a MAUI bug or a WinUI bug. So my bad, this doesn't work as a repro. I'll have another go and re-open if I can show it's a WinUI 3 issue.
I note that some input issues I was experiencing in MAUI were fixed by updating WinUI 3 to 1.4.240211001 anyway, so might not be a problem any longer anyway.
Thanks again for your help!

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ToolTip bug Something isn't working needs-triage Issue needs to be triaged by the area owners team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants