Bug 267811

Summary: Dragging of <tr>s that are position: absolute and have a translate applied erroneously uses the image of the first row
Product: WebKit Reporter: Jeroen Zwartepoorte <jeroen.zwartepoorte>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: REOPENED    
Severity: Normal CC: a_protyasha, bfulgham, rniwa, simon.fraser, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Video of the behavior in Safari 17.2.1 none

Jeroen Zwartepoorte
Reported 2024-01-20 04:46:11 PST
Created attachment 469479 [details] Video of the behavior in Safari 17.2.1 Given a table with `<tr draggable="true" style="translate: 0 0px">` style table rows, dragging the rows is broken in Safari. Try dragging the second row in this codepen: https://codepen.io/jpzwarte/pen/xxBrbNq Works fine in Chromium and FF, but in WebKit, you're not dragging the "Ipsum" row, but instead WebKit always starts dragging the first "Lorem" row. See the video with the behavior in action.
Attachments
Video of the behavior in Safari 17.2.1 (2.37 MB, video/mp4)
2024-01-20 04:46 PST, Jeroen Zwartepoorte
no flags
Jeroen Zwartepoorte
Comment 1 2024-01-22 01:54:05 PST
Found this code in the Vaadin grid component: ``` if (this._safari) { // Safari doesn't position drag images from transformed // elements properly so we need to switch to use top temporarily const transform = row.style.transform; row.style.top = /translateY\((.*)\)/.exec(transform)[1]; row.style.transform = 'none'; requestAnimationFrame(() => { row.style.top = ''; row.style.transform = transform; }); } ``` So it's been known a while.
Jeroen Zwartepoorte
Comment 2 2024-01-22 02:44:04 PST
There is one more line necessary to fix Safari: event.dataTransfer!.setDragImage(row, event.clientX - rowRect.left, event.clientY - rowRect.top); Where event is the DragEvent and rowRect is the bounding client rect of the dragged row. Without this line, Safari will still animate the dragged row from the top of the <tbody>. So to summarise: you can fix the Safari behavior by: 1. Temporarily replace translateY with top 2. Explicitly set the drag image
Radar WebKit Bug Importer
Comment 3 2024-01-22 10:48:30 PST
Taher
Comment 4 2025-06-17 04:55:55 PDT
EWS
Comment 5 2025-06-18 12:55:34 PDT
Committed 296395@main (860e78e7dd0a): <https://commits.webkit.org/296395@main> Reviewed commits have been landed. Closing PR #46845 and removing active labels.
Simon Fraser (smfr)
Comment 6 2025-07-03 12:57:27 PDT
Note You need to log in before you can comment on or make changes to this bug.