Bug 214970 - [iOS] Calling preventDefault() in a pointerdown event handler for an <img> does not prevent system drag
Summary: [iOS] Calling preventDefault() in a pointerdown event handler for an <img> do...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-30 08:48 PDT by Antoine Quint
Modified: 2020-07-30 08:51 PDT (History)
3 users (show)

See Also:


Attachments
Test (289 bytes, text/html)
2020-07-30 08:48 PDT, Antoine Quint
no flags Details

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