Review main Abandoned

91580[BUGFIX] Prevent unexpected drag & drop element duplication in Chrome

Max Frerichs CR -1 V +1 Easy +4 −12 updated 02/04/26, 20:23

Commit message

Since a recent update in the Chromium browser platform, reordering
content elements in the Page module by dragging with the mouse would
create a copy of the element instead of moving it to the desired
position.

The reason is that the `dropEffect` property of the `dragover` event
always changes to `'copy'`, even if the corresponding `dragstart` event
had a `dropEffect` of `'move'`.

We circumvent this by removing the evaluation of `dropEffect` property
and instead directly check the modifier keys of the `DragEvent` in
`DragDropUtility.isCopyModifierFromEvent()`.

Review

  • Code review CR -1
    • Benjamin Franzke -1
    • Josef Glatz -1
  • Verified V +1
    • Josef Glatz +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 3040

Show 915 earlier messages
  1. Max Frerichs uploaded patch set 1 11/12/25, 12:51

  2. core-ci voted on patch set 1 V +1 11/12/25, 13:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89311

  3. Max Frerichs uploaded patch set 2 V +1 11/12/25, 13:45

  4. core-ci voted on patch set 2 V +1 11/12/25, 13:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89328

  5. Benni Mack updated the commit message in patch set 3 V +1 11/12/25, 21:20

  6. core-ci voted on patch set 3 V +1 11/12/25, 21:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89402

  7. Friedemann Altrock commented on patch set 3 11/13/25, 10:43

    This is not a fix, this is a change of behavior. If we only use the dropEffect from the dragstart event, then it is impossible to change between Copy and Move during the drag operation. That means the feature is no longer discoverable, as people need to decide between the two modes _when they start their drag_. A better change would be to explicitly check the modifier keys, as suggested in https://forge.typo3.org/issues/107970#note-2 – this way the behavior can be consistent over all browsers and operating systems.
  8. Max Frerichs uploaded patch set 4 V +1 11/13/25, 13:24

  9. Max Frerichs commented on patch set 4 11/13/25, 13:31

    Reply

    Good catch! I've uploaded a new patch set which removes my changes and incorporates the change suggested by Pierre Frumillon in the comment - which is the simpler and cleaner solution compared to my suggested change. :-)
  10. Max Frerichs updated the commit message in patch set 5 11/13/25, 13:33

  11. core-ci voted on patch set 4 V +1 11/13/25, 13:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89501

  12. core-ci voted on patch set 5 V +1 11/13/25, 13:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89504

  13. Friedemann Altrock commented on patch set 5 11/13/25, 15:10

    drag-drop-utility.ts:33

    Thanks for changing the patch. Now that I see the code in context, I realize that the lines at the end of the method (31-33) already do the correct thing: * for macOS check if the Alt-key is pressed, * on all other platforms, check if the Ctrl-key is pressed. We could simply leave out the other if-conditionals and still fix the bug. ```suggestion return navigator.userAgent.includes('Mac') ? (event.dataTransfer.effectAllowed === 'copy' || event.altKey) : event.ctrlKey; ```
  14. Max Frerichs updated the commit message in patch set 6 V +1 11/13/25, 15:13

  15. core-ci voted on patch set 6 V +1 11/13/25, 15:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89537

  1. Max Frerichs uploaded patch set 7 V +1 11/13/25, 15:35

  2. Friedemann Altrock voted on patch set 7 CR +1 V +1 11/13/25, 15:40

  3. Friedemann Altrock commented on patch set 7 11/13/25, 15:41

    drag-drop-utility.ts:33 Reply

    Done. Thank you, Max!
  4. core-ci voted on patch set 7 V +1 11/13/25, 15:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89544

  5. Max Frerichs commented on patch set 7 11/13/25, 15:55

    drag-drop-utility.ts:33 Reply

    You're right - I've discovered that the previous code did actually change the behaviour on macOS by toggling Copy/Move not only on pressing alt (or cmd), but also on ctrl and option - which could be confusing :D As I've updated the commit message, I've submitted a new patch set which didn't include your changes yet - this was not my intention. Your change should now be included in the latest patch set, which fixes the bug and still ensures correct mod key behaviour on all platforms. :-)
  6. Friedemann Altrock updated the commit message in patch set 8 CR +1 V +1 11/14/25, 09:38

  7. Friedemann Altrock voted on patch set 8 CR +1 V +1 11/14/25, 09:39

  8. core-ci voted on patch set 8 V +1 11/14/25, 09:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89672

  9. Max Frerichs voted on patch set 8 CR +1 11/14/25, 10:00

  10. Dennis Purisevic commented on patch set 8 11/14/25, 13:25

    Hey, thanks for your patch. I had this bug the other day too and thought I'd take a look at it. On the one hand, the hotkey was set incorrectly and since 13.4.8 the default behavior has been changed. Of course, I fixed the bug first before checking to see if anyone else had already worked on it. Maybe you'll take a look at my change too. https://review.typo3.org/c/Packages/TYPO3.CMS/+/91667
  11. Max Frerichs commented on patch set 8 CR 0 11/14/25, 14:05

    Reply

    I'm going to take a look at it. :-)
  12. Max Frerichs voted on patch set 8 CR +1 V +1 11/14/25, 15:21

  13. Josua Vogel voted on patch set 8 CR +1 V +1 11/26/25, 13:57

  14. Dennis Purisevic uploaded patch set 9 CR +1 V +1 11/26/25, 18:33

  15. Dennis Purisevic updated the commit message in patch set 10 11/26/25, 18:35

  16. core-ci voted on patch set 9 V +1 11/26/25, 18:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91043

  17. core-ci voted on patch set 10 V +1 11/26/25, 18:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91044

  18. Josef Glatz voted on patch set 10 CR +1 V +1 11/26/25, 18:52

  19. Josef Glatz commented on patch set 10 CR -1 11/28/25, 11:22

    Update: I cannot verify in all my used latest (based on) chrome browsers. But using the official chrome app (in macOS) does not have the issue anymore. Like @benni@typo3.org also mentioned today. The latest version of Arc it does not work. Some numbers: - official Chrome browser: 142.0.7444.176 → works - Arc browser 1.122.0 (71105): Chromium Engine Version 142.0.7444.176 → does not work Do we have to wait a few days/weeks?
  20. Friedemann Altrock commented on patch set 10 11/28/25, 12:39

    Reply

    > Do we have to wait a few days/weeks? Yes, waiting would be a valid way to "fix" this bug. OTOH, changing the code on our side would free us from flaky versions of any Chromium-based browsers.
  21. Benjamin Franzke commented on patch set 10 CR -1 11/28/25, 13:43

    drag-drop-utility.ts:23 Unresolved

    `event.dataTransfer.dropEffect` contains the "intent" of the user, for browsers that supports copy/move gestures natively, see: https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/dropEffect#:~:text=For%20the%20dragenter%20and%20dragover,that%20the%20user%20is%20requesting. > For the dragenter and dragover events, dropEffect will be initialized based on what action the user is requesting. How this is determined is platform specific, but typically the user can press modifier keys such as the alt key to adjust the desired action. Within event handlers for dragenter and dragover events, dropEffect should be modified if a different action is desired than the action that the user is requesting. Note: The condition thereafter (which checks for mac) is only used where *no explicit* intent (like Mac Safari which reports `dropEffect = 'none'` IIRC) is provided, as some user agents won't report the pressed modifier keys in a drag event, but others report intent (as defined per web spec). This is all highly platform specific, since drag-n-drop is not just engine, but platform specific (as it works across native windows) and even varies on linux between wayland and X11. That means: We must not remove the checks for `dropEffect`, as user agents need to be able to provide this to express user intent. I also checked if another workaround – without removing per-spec behavior – is possible, but the invalid chromium versions really behaved very bad, since we actively try to set `dropEffect = move` in dragstart events, and the browser still reports `dropEffect = copy` in consecutive drag* events. It's a user agent bug, sorry. I'm for: WON'T FIX, given that upstream has fixed and thus confirmed the issue: https://issues.chromium.org/issues/458617018
  22. Josua Vogel wrote 12/02/25, 12:58

    Removed reviewer Josua Vogel.
  23. Dennis Purisevic wrote 01/09/26, 16:31

    Removed cc Dennis Purisevic.
  24. Garvin Hicking commented on patch set 10 01/13/26, 08:36

    Unresolved

    I think we could close/abandon this since the issue has been addressed in chrome by now, yes?
  25. Georg Ringer abandoned the change 02/04/26, 20:23