FriendsOfTYPO3 / frontend_editing

TYPO3 CMS Frontend Editing
https://friendsoftypo3.github.io/frontend_editing/
102 stars 39 forks source link

The new drag handle sometimes doesn't work #680

Closed webian closed 1 year ago

webian commented 1 year ago

In some cases clicking on top of the new drag handle doesn't start the dragging. Clicking on the bottom always work.

Initially I thought that it was because the drag zone didn't cover the handle icon entirely: psiggmbt

But even fixing that didn't fix this bug.

Also, adding console.log('dragstart begin'); at the begin of dragCeStart JS function and console.log('dragstart end'); at the end of that same function, do display the messages in the console so the function is executed but the drag doesn't start.

webian commented 1 year ago

Debugging more I found out that the problem is that in those cases the dragCeEnd function is called immediately after dragCeStart so dragCeEnd function immediately removes class dropzones-enabled from the body making it seem as if the drag never begins.

webian commented 1 year ago

It is a know 10 years old Chrome bug.

It happens sometimes when the DOM is manipulated on dragStart event then dragEnd fires immediately. The solution is to add a setTimeout of 10 milliseconds into the handler and manipulate the DOM in that timeout.