Bug 214970

Summary: [iOS] Calling preventDefault() in a pointerdown event handler for an <img> does not prevent system drag
Product: WebKit Reporter: Antoine Quint <graouts>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: hi, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=214968
Attachments:
Description Flags
Test none

Description Antoine Quint 2020-07-30 08:48:14 PDT
Consider this simple markup:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAQAAADa613fAAAAaUlEQVR42u3PQREAAAgDoK1/aI3g34MGNJMXKiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiJyWXmfZAEMq/KNAAAAAElFTkSuQmCC" onpointerdown="event.preventDefault()">

On macOS, the fact that `event.preventDefault()` is called while handling the `pointerdown` event makes it so that the image cannot be dragged. On iOS the image is draggable after a long press, but I think it should not be to match both the macOS behavior and developer expectation.
Comment 1 Radar WebKit Bug Importer 2020-07-30 08:48:37 PDT
<rdar://problem/66329423>
Comment 2 Antoine Quint 2020-07-30 08:48:50 PDT
Created attachment 405572 [details]
Test
Comment 3 Antoine Quint 2020-07-30 08:50:11 PDT
This came up while fixing bug 214968.
Comment 4 Antoine Quint 2020-07-30 08:51:23 PDT
Useful information from Wenson: the UI process (UIDragInteraction) mediates when to begin a drag on iOS, we’d probably just need to prod it when default is prevented for pointerdown.