Skip to content

REGRESSION(309943@main): No drag event fired when pasteboard has only custom data type#62302

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
aprotyas:eng/311762
Apr 9, 2026
Merged

REGRESSION(309943@main): No drag event fired when pasteboard has only custom data type#62302
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
aprotyas:eng/311762

Conversation

@aprotyas
Copy link
Copy Markdown
Member

@aprotyas aprotyas commented Apr 8, 2026

9df7894

REGRESSION(309943@main): No drag event fired when pasteboard has only custom data type
https://bugs.webkit.org/show_bug.cgi?id=311762
rdar://174354602

Reviewed by Wenson Hsieh.

The migration to beginDraggingSessionWithItems: in the regressing commit
removed the line that wrote WebDummyPboardType to the pasteboard before
starting the drag. WebDummyPboardType ("Apple WebKit dummy pasteboard
type") is one of the types the web view registers for via
registerForDraggedTypes:. When the pasteboard contains only types the
view isn't registered for (e.g. com.apple.WebKit.custom-pasteboard-data),
AppKit does not recognize the view as a valid drag destination and never
calls draggingEntered: or draggingUpdated:. As a result, drag events
never fire, breaking sites like Slack which hide the default drag
preview with a 1x1 drag image and place a custom overlay via drag
events.

To fix this, we restore WebDummyPboardType on the drag pasteboard after
restoring legacy data in the DHTML/legacy drag path.

Tests: TestWebKitAPI.DragAndDropTests.DraggableElementWithOnlyCustomPasteboardDataFiresDragEvents

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::startDrag):
* Tools/TestWebKitAPI/Resources/cocoa/draggable-only-custom-data.html: Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm:
(TEST(DragAndDropTests, DraggableElementWithOnlyCustomPasteboardDataFiresDragEvents)):

Canonical link: https://commits.webkit.org/310833@main

78e5f6e

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios 🛠 mac ✅ 🛠 wpe 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl 🧪 ios-wk2 🧪 api-mac 🧪 api-wpe ✅ 🛠 vision-apple
🧪 ios-wk2-wpt 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
🧪 api-ios 🧪 mac-wk1 ✅ 🛠 gtk
🛠 ios-safer-cpp 🧪 mac-wk2 ❌ 🧪 gtk-wk2
🛠 vision 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 vision-sim 🧪 mac-wk2-stress 🛠 playstation
✅ 🛠 🧪 unsafe-merge 🧪 vision-wk2 🧪 mac-intel-wk2
✅ 🛠 tv 🛠 mac-safer-cpp
🛠 tv-sim
🛠 watch
✅ 🛠 watch-sim

@aprotyas aprotyas self-assigned this Apr 8, 2026
@aprotyas aprotyas requested a review from cdumez as a code owner April 8, 2026 22:12
@aprotyas aprotyas added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Apr 8, 2026
@aprotyas
Copy link
Copy Markdown
Member Author

aprotyas commented Apr 9, 2026

Thank you for the review!

@aprotyas aprotyas added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Apr 9, 2026
… custom data type

https://bugs.webkit.org/show_bug.cgi?id=311762
rdar://174354602

Reviewed by Wenson Hsieh.

The migration to beginDraggingSessionWithItems: in the regressing commit
removed the line that wrote WebDummyPboardType to the pasteboard before
starting the drag. WebDummyPboardType ("Apple WebKit dummy pasteboard
type") is one of the types the web view registers for via
registerForDraggedTypes:. When the pasteboard contains only types the
view isn't registered for (e.g. com.apple.WebKit.custom-pasteboard-data),
AppKit does not recognize the view as a valid drag destination and never
calls draggingEntered: or draggingUpdated:. As a result, drag events
never fire, breaking sites like Slack which hide the default drag
preview with a 1x1 drag image and place a custom overlay via drag
events.

To fix this, we restore WebDummyPboardType on the drag pasteboard after
restoring legacy data in the DHTML/legacy drag path.

Tests: TestWebKitAPI.DragAndDropTests.DraggableElementWithOnlyCustomPasteboardDataFiresDragEvents

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::startDrag):
* Tools/TestWebKitAPI/Resources/cocoa/draggable-only-custom-data.html: Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm:
(TEST(DragAndDropTests, DraggableElementWithOnlyCustomPasteboardDataFiresDragEvents)):

Canonical link: https://commits.webkit.org/310833@main
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 310833@main (9df7894): https://commits.webkit.org/310833@main

Reviewed commits have been landed. Closing PR #62302 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 9df7894 into WebKit:main Apr 9, 2026
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Apr 9, 2026
@aprotyas aprotyas deleted the eng/311762 branch April 9, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants