-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Attempted fix for both drag and doubleclick #1704
Conversation
I've just tested MacOS and Windows. MacOS: Everything works fine, dragging works and double click events on a |
Ah thanks for trying 🙏 I wonder why webview 2 would be so different around this? I'll test Linux tonight and think about a windows fix. |
I suspect it's because of the Win32 ReleaseCapture call in startDrag. |
Can confirm it is the drag that is preventing the double click events from propagating. |
I've just pushed a shameful hack that does appear to fix it, though I suspect it wont work on all machines in all scenarios 😱 |
@leaanthony I checked on Windows, there is the same problem as it was on MacOS. Without this hack (but with doubleclick not working), there is no delay when moving the window. |
Without rewriting the whole of the move window code (and I did try tonight) I'm not sure what we can do right now |
On Windows, with the hack I sometimes can't right click to open the inspector and check which events are running. This highlights the elements, as if I'm double-clicking, but I'm only pressing the right mouse button. 2022-08-06.20.27.03.mov |
I don't think it's worth using move window anywhere. In practice, this is rarely used. Perhaps it should be documented that there is such a behavior as not passing events to child elements. UPD: |
I found the reason for the quick closing of the context menu. When pressing with two fingers on the touchpad, the events of pressing and releasing occur very quickly, if I make a click, then enough time elapses that this bug does not exist. UPD |
Thanks for your testing. I think we'll just change how windows implements drag. Hacks are too flaky 😁 |
I've tried all different approaches: JS only solution that only sends a drag message if the button is down AND you're moving, and also a Go-side solution that basically does the same. It appears the same issue occurs: There's no way to detect the mouse button up event and therefore reset the drag flag. This leads to some odd behaviour where sometimes it drags, sometimes it's delayed, sometimes it works just fine. If webview2 forwarded mouse events to the host then we'd be ok but it doesn't. I've posted a couple of messages to the WebView2 feedback around this so lets see what comes back. |
Just pushed a potential fix. Seems to work well for Windows. Not tried the others but it shouldn't affect anything. |
@ghostiam how does this work for you? |
@leaanthony checked, events on windows work, dragging of windows works too. |
I can also confirm that it works as expected on MacOS and Windows within our application. Thanks @leaanthony for looking into this 🙏 |
Fixes #1703
Working on: