[Webkit-unassigned] [Bug 257735] New: When mouse/trackpad click on WKWebView dismisses a UIKit menu, web gets touch down with no touch up, and no subsequent mouse events
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jun 5 17:54:35 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=257735
Bug ID: 257735
Summary: When mouse/trackpad click on WKWebView dismisses a
UIKit menu, web gets touch down with no touch up, and
no subsequent mouse events
Product: WebKit
Version: Safari 16
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: UI Events
Assignee: webkit-unassigned at lists.webkit.org
Reporter: krevis at figma.com
Created attachment 466596
--> https://bugs.webkit.org/attachment.cgi?id=466596&action=review
Xcode project for an iPad app to demonstrate the bug
We have a UIKit app containing a WKWebView, with buttons that show a UIKit menu above the web view. When we show a menu, then dismiss it by clicking with mouse/trackpad on the web view, the web view’s event handling is disrupted, making it unusable until the page is reloaded:
- A pointerdown event with pointerType “touch” is sent, with no corresponding pointerup or pointercancel.
- Subsequent clicks don’t send pointerdown or pointerup at all. Instead we get old-style mousedown and mouseup events.
Steps:
1. Run attached project on iPad with a mouse or trackpad attached, or in the simulator.
2. Using any input method, press the “Menu” button to show a menu.
3. Using mouse or trackpad, click and release, outside the menu, on the web view.
4. Click again in the web view.
Expected:
- The web view prints “pointerdown mouse” and “pointerup mouse”, once for each click.
Actual:
- The first click makes the web view print “pointerdown touch”. There is no subsequent “pointerup” or “pointer cancel”.
- The second click prints “Old-style mousedown! Should have seen a pointerdown instead” and “Old-style mouseup! Should have seen a pointerup instead”.
- It remains in this state until you press the Reload button to reload the page.
Notes:
The bug happens on iPadOS 15, 16, and 17 developer beta 1. Both on device and in the simulator.
The sample app demonstrates two different bugs — see the explanatory text when you run the app. This is “Bug #2”.
In the test app, there is a native gesture recognizer above the web view, that does nothing but observe touches and log them to the console. It sees touches with type `.indirectPointer` as expected.
When the bug is triggered, you’ll note that it gets a touch began, but *not* a touch ended or cancelled, and then reset. I’m guessing that WebKit’s `WKMouseGestureRecognizer` is not expecting that sequence, and somehow leaves the web content process in a weird state.
This bug makes it very difficult to use modern pointer events in our web content. We would really like to use them over the old-style mousedown/mouseup events, since they present a unified interface for touches, pointing devices, and Apple Pencil, but it’s very hard to deal with a bug where it just stops working and there’s no way to fix it afterwards.
It’s also difficult to work around, because UIKit doesn’t always provide a simple way to find out when the menu is shown and dismissed. If the menu is the overflow menu in a navigation bar, for instance, it doesn’t provide a way to observe the menu, and there isn’t a way to make a custom subclass of UIBarButtonItem for it (which could).
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230606/ce7874cb/attachment.htm>
More information about the webkit-unassigned
mailing list