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

WinUI 3 ScrollViewer does not bubble PointerCaptureLost event when ancestor calls CapturePointer in PointerPressed #9883

Closed
rozele opened this issue Aug 9, 2024 · 3 comments
Labels
area-Pointer area-Scrolling bug Something isn't working closed-Fixed Described behavior has been fixed. fix-released The fix has been in a release (experimental, preview, stable, or servicing). team-Controls Issue for the Controls team
Milestone

Comments

@rozele
Copy link

rozele commented Aug 9, 2024

Describe the bug

In UWP, if you have something like:

var stackPanel = new StackPanel();
var scrollViewer = new ScrollViewer();
stackPanel.Children.Add(scrollViewer);
stackPanel.PointerPressed += (sender, args) => {
  stackPanel.CapturePointer(args.Pointer);
}
stackPanel.PointerCaptureLost += (sender, args) => {
  Debug.WriteLine("PointerCaptureLost");
}

when you start a direct manipulation on the ScrollViewer with a touch gesture, the PointerCaptureLost event bubbles to the StackPanel. In WinUI 3, this does not occur.

This manifests in a limitation for React Native Windows, which uses pointer routed events at the top-level WinUI component to proxy events to JavaScript, and relies on ScrollViewer bubbling the PointerCaptureLost event to know when to cancel a gesture sequence emitted to JavaScript.

Steps to reproduce the bug

  1. Set up code like the above, where a ScrollViewer is nested in a WinUI component ancestor that calls CapturePointer in it's PointerPressed callback.
  2. Subscribe the PointerCaptureLost event on the ancestor that captures the pointer.
  3. Use a pan gesture to scroll the ScrollViewer
  4. Observe that the PointerCaptureLost event does not bubble to the ancestor, nor does PointerReleased (expected) or PointerCanceled, so we have no terminal event to establish that a touch gesture has been interrupted / canceled.

Expected behavior

WinUI 3 ScrollViewer should bubble a PointerCaptureLost event like it does in UWP when a touch gesture results in direct manipulation in a ScrollViewer.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.5: 1.5.240627000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@rozele rozele added the bug Something isn't working label Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Aug 9, 2024
@codendone codendone added area-Scrolling team-Controls Issue for the Controls team area-Pointer and removed needs-triage Issue needs to be triaged by the area owners labels Aug 9, 2024
@rozele
Copy link
Author

rozele commented Aug 12, 2024

What makes this an even bigger problem is that WinUI 3 also does not appear to bubble the PointerReleased event to the ancestor unless we call CapturePointer on it, for either mouse or touch (rendering our root-level pointer dispatch approach pointless).

@llongley llongley closed this as not planned Won't fix, can't repro, duplicate, stale Aug 13, 2024
@llongley llongley added the closed-Duplicate Described behavior is already captured by another issue. label Aug 13, 2024
@codendone
Copy link
Contributor

This was resolved as duplicate of an internal bug. Changing this to fixed. It looks like the fix is in 1.6-experimental2 and 1.6-preview1.

@codendone codendone added closed-Fixed Described behavior has been fixed. fix-released The fix has been in a release (experimental, preview, stable, or servicing). and removed closed-Duplicate Described behavior is already captured by another issue. labels Aug 14, 2024
@codendone codendone added this to the WinAppSDK 1.6 milestone Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Pointer area-Scrolling bug Something isn't working closed-Fixed Described behavior has been fixed. fix-released The fix has been in a release (experimental, preview, stable, or servicing). team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

3 participants