Bug 257736

Summary: When mouse/trackpad click on WKWebView dismisses a UIKit popover, web gets pointerdown/up events with type "touch" not "mouse"
Product: WebKit Reporter: Kurt Revis <krevis>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: a_protyasha, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Xcode project to demonstrate the bug none

Description Kurt Revis 2023-06-05 18:33:59 PDT
Created attachment 466597 [details]
Xcode project to demonstrate the bug

We have a UIKit app containing a WKWebView, with buttons that show a UIKit popover above the web view. When we show a popover, then dismiss it by clicking with mouse/trackpad on the web view, the web view sees a PointerEvent with pointerType “touch”, even though no touch is involved. It should be “mouse”.

Steps:
1. Run attached project on iPad with a mouse or trackpad attached, or in the simulator. 
2. Using any input method, press the “Popover” button to show a popover.
3. Using mouse or trackpad, click and release, outside the popover, on the web view.

Expected:
- The web view prints “pointerdown mouse” and “pointerup mouse”.

Actual:
- The web view prints “pointerdown touch” and “pointerup touch”.
- Subsequent clicks work as expected.

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 #1”.  

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.  So the problem is likely to be in WebKit.

Also filed as Apple Feedback FB12229984.
Comment 1 Radar WebKit Bug Importer 2023-06-06 16:39:11 PDT
<rdar://problem/110353696>