Drag and Drop problem in Firefox

Drag and Drop problem in Firefox

by Stefan Oertel -
Number of replies: 19

Hi Gordon,

we have a problem with JMatch in Mozilla Firefox (newest Version under Windows XP => 7). We cannot drag the word pairs together. The drag event did not start. It only selects the words under the cursor. 

In other browsers (IE 8, IE11, Opera, Chrome, Safari) everything is fine. We using the plugin version 2014.06.16 (22) (2014061622).


Thanks, Stefan

Average of ratings: -
In reply to Stefan Oertel

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Stefan,

thanks for letting me know. It seems to be an issue in FF for Mac too, so I will investigate and let you know.

regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Stefan,

I think this is fixed now in the latest version of the HotPot module.

Please could you upgrade you Moodle site when you are able, and let me know if this fixes the issue for you.

thanks again for bringing this issue to my attention approve

regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Stefan Oertel -

Hi Gordon,

it works now in FF too. Great!

My pupils and I say THANK YOU big grin

In reply to Stefan Oertel

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Stefan,

you're welcome. Actually, I am still having some problems with audio players in JMatch/JMix in FF. I will let you know when I have fixed those.

best regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Stefan,
I think I have fixed the audio players on JMatch drag-and-drop for the TaskChain module, so please up date that modue if you are using it.

At some point, I will add the changes to the HotPot module for Moodle 2.x too.

regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Marc Druilhe -

Hi Gordon,

It doesn't seem to work either for me with Firefox. Drag & drop works fine in Google Chrome but I've got the same behavior as Stephan in Firefox : "The drag event did not start. It only selects the words under the cursor. "

My versions are :

Moodle : Moodle 2.8.1+ (Build: 20141211)

Hotpot module : 2015.01.26 (59)

Firefox : 35.0.1 (Windows 7)


Thanks in advance for any clue.

best regards.

Marc


In reply to Marc Druilhe

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Marc,
I wonder if the following JMatch works OK for you:

It works OK in my Firefox 35.0.1 (Mac). Please could you try it with your Firefox 35.0.1 (Win).

If the activity there works OK in your Firefox, please upload your own JMatch to the above course and try viewing that.

If either my JMatch or your JMatch doesn't work for you in Firefox, please open the Javascript console in your Firefox brower, and let me know if the Javascript error that is reported there when you try to drag on of the JMatch items.

thanks
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

I tried the above JMatch with Firefox 35.0.1 (Win XP) and it worked fine, that is to say I was able to drag items from the right, drop them next to items on the left, and complete the exercise successfully.

Perhaps the next thing to try is your JMatch on my testing server. Please upload your JMatch to my testing server and let us know what happens.

regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Glenys Hanson -

Just to confirm it worked fine for me on Firefox : 35.0.1 (Windows 7) as well as on OS X 10.8.5.

Cheers,

Glenys

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Marc Druilhe -

Hi Gordon,

Thanks a lot for your help. I tried your JMatch and I've got the same result : drag'n drop doesn't work sad

Unfortunately, I can't see any error message spitted to the console nor javascript error. It seems that the start drag event is not fired. Btw the drag-n-drop is working in other Moodle pages (eg. for changing activities order)

Also, the HTML page generated with HotPotatoes is working fine.

I'm not a javascript expert, but it seems that it is not the same event used to start drag in the  static HP HTML generated file and in the Moodle page : mouseDown in the first case and touchstart in the HP Moodle module.

Best regards,

Marc


In reply to Marc Druilhe

Re: Drag and Drop problem in Firefox

by Marc Druilhe -

Hi Gordon,


I just edited the attempt/hp/hp.js file in order to remove the "event mapping" (ie. mousedown ->touchstart) and it works fine !

Here is the edited code :


/**
* HP_fix_event
*
* @param string evt : the name of the event (without leading 'on')
* @return string
*/
function HP_fix_event(evt) {
if (typeof(document.body.ontouchstart)==='undefined') {
switch (evt) {
case 'tap' : return 'click';
case 'touchstart' : return 'mousedown';
case 'touchmove' : return 'mousemove';
case 'touchend' : return 'mouseup';
}
} else {
/* (MD) Commented out to make it working on FF
switch (evt) {
case 'click' : return 'tap';
case 'mousedown' : return 'touchstart';
case 'mousemove' : return 'touchmove';
case 'mouseup' : return 'touchend';
}
*/
}
return evt;
}

I don't know what is the side effect ??


Best regards

Marc


In reply to Marc Druilhe

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Marc,
nice detective work there approve

It seems that Firefox 35.0.1 when running on your device thinks that a touch screen is available. 

Could it be that your PC has both a touch screen and a mouse? In which case, I guess the JMatch drag-and-drop works if you drag the items with your finger on the touch screen. Yes?

The edit you have made to "hp.js" will fix the isue on your device, but it will also disable the tap events on all other touchscreen devices, so for the long term we need to find a solution that works not only on devices that are have either a touchscren or a mouse, but also on devices that have both.

I may need your help with testing a solution, because I do not have physical access to such a device. But  first, could you confirm whether or not your PC has a touchscreen, and, if you restore "hp-.js" to its original condition, whether or not you can drag-and-drop JMatch items with your finger on the touchscreen.

thanks
Gordon 

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hello,
after reading around a little, it seems to me that the long term solution is to replace the current either "click or tap" paradigm, with a system that allows mouse events in browsers that say they can handle them, and separately will allow tap events in browers that say they can handle them.

This will be both robust and efficient, and I think it won't take too much time and effort to figure out.

I may need your help in testing the solution wink

regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Marc Druilhe -

Hi Gordon,


Unfortunately, my device (an HP pavilion, with a syncmaster as external display) doesn't have a touchscreen.

I suppose that either Firefox is not handling document.body.ontouchstart properly or it is a configuration problem (since it seems to work on some other FF/W7 configurations). I also guess that the document.body.ontouchstart property detects if the browser supports touch events, it doesn't determine if the device supports them.

I'm really not a javascript expert and I am new to Moodle (so I may be wrong) but maybe the D&D could be handled using a higher level library such as http://yuilibrary.com/yui/docs/dd/ (assuming Moodle is using YUI as a JS framework) ?

Just my 2 cents.

Of course I'm willing to help you with tests, don't hesitate to ask me.

Best regards,

Marc



In reply to Marc Druilhe

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Marc,
please could you try the sample HotPot JMatch on my testing server again with exactly the same browser + device that you used before and let me know how you get on.

thanks
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Marc Druilhe -

Bingo !

Works fine now  in my browser.

Thanks for your work smile

Marc

In reply to Marc Druilhe

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Thanks for confirming Marc approve

I have also confirmed that the modified javascript works in a click-only PC browsers, and tap-only mobile browsers, so I am pretty sure we have got to the root of the problem.

Thanks for bringing this issue to my attention and for helping to confirm the fix. Please update the HotPot module on your Moodle site at the net convenient opportunity. I will update the TaskChain module in due course too.

regards
Gordon

In reply to Gordon Bateson

Re: Drag and Drop problem in Firefox

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

to any TaskChain users reading this,

I have applied a similar fix to the TaskChain module. Please update the TaskChain module on your Moodle site at the next convenient opportunity.

best regards
Gordon