dragenter event is fired twice when the dropzone is parent of draggable or draggable itself with Firebug

NEW
Unassigned

Status

()

defect
7 years ago
3 years ago

People

(Reporter: danya.postfactum, Unassigned, NeedInfo)

Tracking

16 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.92 Safari/537.4

Steps to reproduce:

Create draggable element and listen ondragenter event of it or its parent. Start to drag the element. 

<a ondragenter="console.log(event.type)" draggable ondragstart="event.dataTransfer.setData('Text', 'test'); return true" href="#">Draggable</a>


Actual results:

dragenter event is fired twice on start dragging. If we move the element out of dropzone, dragleave event will be fired once only, though.


Expected results:

dragenter event should be fired only once
Could you attach a testcase, please.
Attachment #674965 - Attachment mime type: text/plain → text/html
Comment on attachment 674965 [details]
This demonstrates firefox dragenter twofold event bug

Grab the first square blue border and drop (or move away from) it on body. You get:

dragenter BODY
dragenter BODY
dragleave BODY

instead of

dragenter BODY
dragleave BODY


So, we have entered twice into the river :)

Try to grab the first square (red area) and drop it on body. You get:

dragenter A
dragenter A
dragenter BODY
dragleave A
dragleave BODY

instead of 

dragenter A
dragenter BODY
dragleave A
dragleave BODY

It is interesting, that if the draggable has TextNode, we get:
dragenter A
dragenter #text
dragenter A
dragleave #text
dragenter BODY
dragleave A
dragleave BODY

but if we have a Span instead of TextNode, we get:
dragenter SPAN
dragenter SPAN
dragenter A
dragleave SPAN
dragenter BODY
dragleave A
dragleave BODY
What I see in the webconsole with your testcase (FF16 on Win 7):

1) 1st blude border:
dragenter BODY 
dragleave BODY

2) 1st red square:
dragenter A
dragenter BODY
dragleave A
dragleave BODY

3) Text of 2nd square:
dragenter A
dragenter #text
dragenter A
dragleave #text
dragenter BODY
dragleave A
dragleave BODY

4) Yellow square:
dragenter SPAN
dragenter A
dragleave SPAN
dragenter BODY
dragleave A
dragleave BODY

Could you try with a new profile, please.
https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles
Excuse me. This bug is caused by FireBug...
I have disabled FireBug and this issue has dissapeared.
Thanks for the report.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
Summary: dragenter event is fired twice when the dropzone is parent of draggable or draggable itself → dragenter event is fired twice when the dropzone is parent of draggable or draggable itself with Firebug
Duplicate of this bug: 804038
I have been testing this with a new fresh Firefox profile (no Firebug installed) and here is what I see in Web Console:

1) 1st blude border:
dragenter BODY   2x
dragleave BODY

2) 1st red square:
dragenter A      2x
dragenter BODY 
dragleave A
dragleave BODY

-> Note that Web console groups logs so, you need to check the red number at the right side of a message to see that it's been logged more than once.


To, me it looks like 'dragenter' is called twice even if Firebug is not installed.

Could anyone yet verify?

Honza
(In reply to Jan Honza Odvarko from comment #9)
> To, me it looks like 'dragenter' is called twice even if Firebug is not
> installed.
> 
> Could anyone yet verify?

Indeed, "dragenter A" and "dragenter SPAN" are logged twice (tested with FF19).
(In reply to Loic from comment #10)
> Indeed, "dragenter A" and "dragenter SPAN" are logged twice (tested with
> FF19).
Thanks for the update!

So, I am reopening this report.

Honza
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: WORKSFORME → ---
Posted file moving dragenter
Multiple dragenters are invoked when the dragenter element is moving.  See the attachement.

Since this was a similar issue, I added it to this ticket rather than opening a new one.
Attachment #685248 - Attachment mime type: text/plain → text/html
User Agent 	Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0
Version 	46.0a1
Build ID 	20160112030207
Channel 	nightly

Thank you for taking time to report this.
Are you still able to reproduce this in the latest version ?  I cannot reproduce this.
Component: Untriaged → Drag and Drop
Flags: needinfo?(danya.postfactum)
Product: Firefox → Core
It is not reproducible. Closing this as works for me.
Feel free to reopen this bug if it still reproduces in the latest versions. Thanks
Status: REOPENED → RESOLVED
Closed: 7 years ago4 years ago
Resolution: --- → WORKSFORME
I can reproduce the attached testcase in:

Version: 47.0a2
Build ID: 20160314004022
Update Channel: aurora
User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0

And I have run into this in an app I'm developing right now. Have to find a good workaround.
I forgot to mention that in the app I'm building I do not use the draggable attribute. I'm dragging files from desktop onto the element with the dragenter handler. But still the same issue I guess.
Yes, the event firing twice when you drag file from the Finder, straight into the window. 


P.S. I think Firefox should be removed from the internet. So much of so stupid bugs, that take hours to hack around, man...
Posted image Drag and drop.PNG
Reopening this bug as I can reproduce the issue in Firefox release version.
However, I could not reproduce this in nightly channel.
The 'dragenter' is logged twice in release version When the first blue border is dragged. See attachment. 

I tested this using the following environments:
Update Channel 	nightly
Version 	48.0a1
Build ID 	20160328030215
User Agent 	Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:48.0) Gecko/20100101 Firefox/48.0

and

Update Channel 	release
Version 	45.0.1
Build ID 	20160315153207
User Agent 	Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0

It is also reproducible in win-7.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Status: REOPENED → NEW
(In reply to Abe - QA from comment #18)
> Reopening this bug as I can reproduce the issue in Firefox release version.
> However, I could not reproduce this in nightly channel.

Because you enabled e10s, it seems to be fixed with e10s, but it's still broken in non-e10s mode.
mibus32@gmail.com, can you test Nightly to confirm it works as intended with e10s enabled (you can enable/disable e10s in about:preferences#general > Enable multi-process Nightly): https://nightly.mozilla.org/
Flags: needinfo?(mibus32)
Yes, it is fixed with e10s but broken without e10s. Thanks Loic.
Flags: needinfo?(danya.postfactum)
You need to log in before you can comment on or make changes to this bug.