Skip to content Skip to sidebar Skip to footer

HTML5 Image Drag Event - CtrlKey Remains False In Firefox 29

This works great in Chrome, but what do I need to change to make it work in Firefox? e.ctrlKey remains false in FF: $('img').on('drag', function(e){ console.log('ctrlKey', e.ct

Solution 1:

I think this is a bug in Firefox. After some digging in Bugzilla I found unconfirmed bug similar to your problem titled DragEnd event does not reflect real ctrl/shift/alt key status.


Solution 2:

It seems you can detect the ctrlKey in startdrag event, so as a workaround, you can just $(event.dataTransfer.setData('ctrlKey',event.ctrlKey) in startdrag. Then you can read it by $(event.dataTransfer.getData('ctrlKey') inside dragEnd event


Post a Comment for "HTML5 Image Drag Event - CtrlKey Remains False In Firefox 29"