Bug 257736 - When mouse/trackpad click on WKWebView dismisses a UIKit popover, web gets pointerdown/up events with type "touch" not "mouse"
Summary: When mouse/trackpad click on WKWebView dismisses a UIKit popover, web gets po...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-06-05 18:33 PDT by Kurt Revis
Modified: 2023-06-06 16:39 PDT (History)
3 users (show)

See Also:


Attachments
Xcode project to demonstrate the bug (170.60 KB, application/zip)
2023-06-05 18:33 PDT, Kurt Revis
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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>