Closed Bug 894345 Opened 7 years ago Closed 7 years ago

[New Tab Page] Fix drag/drop behavior when rearranging sites


(Firefox :: Tabbed Browser, defect)

Not set



Firefox 25


(Reporter: ttaubert, Assigned: ttaubert)




(1 file)

While investigating some improvements to the about:newtab drag-and-drop tests, I stumbled over broken d&d behavior, implemented by dropTargetShim.js.

The problem is that the shim disables all pointer events for the grid (as necessary) but fails to call event.preventDefault() on dragenter and dragover so that the drag operation always fails (as far as the d&d service is concerned). about:newtab successfully drops the site anyway but I'm sure this could hit us or add-on authors in the future again, so we should fix that.
This patch implements the d&d correctly as it uses preventDefault() to communicate with the d&d service on dragenter/over and drop. I think may not have completely understood how it all works back when I implemented it first. I certainly do now.

The sites.js change removes unused code I found.

The change to _whenTransitionEnded() in transformations.js was necessary due to some strange behavior when other properties that were transitioned as well (but we didn't really care about) finished earlier than expected. This aborted the transition a little too early, unpredictibly, somtimes.
Attachment #776332 - Flags: review?(jaws)
Blocks: 894876
Blocks: 895359
Comment on attachment 776332 [details] [diff] [review]
fix drag/drop behavior when rearranging sites

Review of attachment 776332 [details] [diff] [review]:

::: browser/base/content/newtab/dropTargetShim.js
@@ +218,4 @@
>      let node = aTarget.node;
>      let event = document.createEvent("DragEvents");
> +    // Let the event not bubble to avoid recursion.

// The event should not bubble to prevent recursion.
Attachment #776332 - Flags: review?(jaws) → review+
Closed: 7 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 25
Depends on: 948413
Depends on: 1068354
Depends on: 1000097
You need to log in before you can comment on or make changes to this bug.