benlilaj / gears

Automatically exported from code.google.com/p/gears
0 stars 1 forks source link

Drag and drop broken - Firefox 3.6.6 under Win7 doesn't work; other browsers/OS combinations flakey #1021

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a bit complicated, so please be patient with the long post.  The bottom 
line is that drag and drop seems to be broken, though the details vary by OS 
and browser.

The big problem is that I am unable to get drop events under firefox 3.6.6 / 
Win7.

Other issues shown by this test include;
  XP doesn't seem to deliver events with the mouse down.
  The relationship between leave and drop is a bit fuzzy.

Attached .html file is self-contained - cut down from a real application.  As 
you know, the drag and drop API is a bit involved; this was about as simple a 
test case as I could construct.

What steps will reproduce the problem?
1. Save file on local disk
2. open with browser
3. drag any file onto the 'drop here' box

What is the expected output? What do you see instead?

IE 8 works as expected under win 7, almost works under XP SP3.latest.
Firefox does not work under win 7, almost works under XP SP3.latest.
Chrome works as expected under win7, almost works under XP SP3.latest.

What's expected:
    o Box turns from white to green when the file hovers over the box
          W7: 
        IE:OK  
        FF:OK  
        CM:OK
          XP: 
        IE: No, but turns green on drop 
        FF: No, but turns red on drop (cursor moving to alert) 
        CM: No, but turns green on drop
    o Cursor changes to 'copy' when the file hovers over the box
          W7: 
        IE:OK  
        FF: Shows 'prohibited; ('none') instead of 'copy'
        CM:OK
          XP: 
        IE:  OK (icon is "+")
        FF:  No, does not change
        CM:  OK (icon is "+") - but doesn't revert when dragleave
    o Box turns red if cursor leaves box (or if bad drag data)
          W7: 
        IE:OK  
        FF:OK  
        CM:OK
          XP: 
        IE: No, seems not to deliver events while mouse button depressed
        FF: No, seems not to deliver events while mouse button depressed
        CM: No, seems not to deliver events while mouse button depressed
    o Drop produces an alert
          W7:   
        IE:OK  
        FF:Box turns red, firebug shows a dragleave event  There is no drop.
        CM:OK
          XP: 
        IE:  OK
        FF:  OK
        CM:  OK
    o Box turns yellow after alert
          W7: 
        IE:OK  
        FF:No drop event
        CM:OK
          XP: 
        IE:  OK
        FF:  OK
        CM:  OK

What version of the product are you using? On what operating system?
Gears 0.5.33.0, XP SP3.latest, Win7.latest., IE8.latest, FF3.6.6 (latest), 
Chrome 5.0.375.99 (latest)

I have not tested other browsers/browser versions, though that might prove 
illuminating...

Please provide any additional information below.

I have executed the test case from a network share under all conditions listed, 
so I am certain that it's exactly the same code :-)

I have tried various incantations with preventDefault and friends; the code 
attached is my best shot at what seems to work best.

Yes, I seem to have to call setDropEffect before AND after preventDefault - 
though I don't understand why.

I have consulted the gears examples, as well as several open source codes that 
claim to use gears, but I don't see any difference that explains this behavior.

Any advice/help would be greatly appreciated.

Original issue reported on code.google.com by timothe....@gmail.com on 13 Jul 2010 at 3:36

Attachments:

GoogleCodeExporter commented 9 years ago

I have discovered a work-around for this in javascript - with no clue as to why 
it works. It suffices to simply read the HTML5 field dataTransfer.dropEffect 
after calling the Gears desktop.setDropEffect method.

e.g.

window['fred'] = evt.dataTransfer.dropEffect;

window.fred is not used anywhere else - it's coded that way so that any 
optimizer can't remove the apparently useless read.

You can use it, or watch the firefox bugzilla case that I entered 
(https://bugzilla.mozilla.org/show_bug.cgi?id=578757) to see if anyone can 
explain this. Meantime, bracketing the read with a suitable browser conditional 
(and maybe memorializing someone other than fred :-) should make javascript 
code work.

It would be better if someone from the Gears team could fix this inside Gears.

Original comment by timothe....@gmail.com on 22 Jul 2010 at 2:31

Attachments: