Send Touchpad Scrolling Input for CoreWebView2CompositionController
Is your feature request related to a problem? Please describe.
Yes, this feature request relates to the problem that in the composition hosting environment, it is not possible to directly send a touchpad scrolling event in the CoreWebView2CompositionController. The touchpad event includes smooth scrolling in a way that it should be possible to send horizontal and vertical scrolling at the same time. Additionally, it is currently not possible to send a pinch to zoom command.
Describe the solution you'd like and alternatives you've considered
I would like an API to be able to send scroll event that is possible for both vertical and horizontal movement as well as the scaling factor at the same time.
Currently, I am aware of three alternatives but all of them have drawbacks.
- It is possible to just not handle anything and it will be sent as the regular mouse event. This approach is what is currently in use for
microsoft-ui-xaml's WebView2 control. Providing that the horizontal scroll error is fixed, the drawbacks are that the scrolling is not smooth and it is not possible to make regular pinch to zoom (by "regular pinch to zoom" I mean the way of pinch to zoom is done on the regular Edge browser). - It is also possible to use DevTools Protocol. This behavior is somewhat achievable by
Input.dispatchMouseEventandEmulation.setPageScaleFactorcombined. However, when the page is zoomed in, the dispatch mouse event coordinates act like there is no zooming and panning on the page. Additionally, some websites do not work with this method (For example, vscode.dev) In addition to that, I have also seen another alternative to useInput.synthesizePinchGesturein #485 . I did not fully test it yet but it has a delay and is not suitable for sending live touchpad pinch or scroll events. (Note: I got touchpad scroll/zoom in UWP using ElementInteractionTracker) - The current workaround I am using is by handling touchpad scroll myself and using regular SendMouseInput similar to the first workaround. The downside is that I can only send either a horizontal scroll or a vertical scroll at a time, and it is not possible to do semantic zoom. (Note: I got touchpad scroll in UWP using ElementInteractionTracker)
Thanks for the comprehensive description. Added it to tracked to be included in our backlog.
Thanks! I would like to also briefly mention that I am not very sure if using ElementInteractionTracker in UWP to track touchpad scrolling is the best way or not because to my knowledge it also has some limits for me to set how much I can scroll and zoom in each direction. There may be other APIs that provide more accurate information that I may not know about yet.
With that said, if the team found that there are some other ways to send more accurate touchpad scrolling information than providing horizontal, vertical, and scale value, the team may adjust the actual API to be implemented if the team sees fit. In this issue, my main goal is to get a reliable touchpad scrolling and zooming on WebView2 working as well as the normal Edge browser or window hosting version of WebView2.
Reassigning to @champnic in case he or @bradp0721 would have questions or comments regarding this. Thanks.
i support
Any updates on this? My current issue is that this is a roadblock to having a good user experience. The current feeling of touchpad scrolling and zooming inside WinUI 2/3 webview2 feels massively different and Microsoft Edge has way better zooming and scrolling experience
No real updates here unfortunately. We have the basic understanding of the approach we'd like to take to enable this, but no devs available to implement this at the moment.
any updates? 👀