During my recent work with jQuery-UI, I discovered that on Safari, the embedded flash videos cannot be played if they are made draggable using the draggable plugin (http://dev.jqueryui.com/ticket/3575). Providing an inconsistent UI for our users on a browser used by approximately 8.5% (and rising, based on reports by hitslink http://marketshare.hitslink.com) of internet users, I investigated a little more about what the root cause of the issue was and found out that the issue manifested itself on Firefox in a different way. On Firefox 3, the flash video, once dragged, would just get stuck to the mouse and continue to drag even after the user let go of it. In other words, it was a “sticky” situation.
Turns out that jQuery-UI (version 1.7.1) prevents the default action for the mouse events – mousedown, mouseup, click – on the elements it’s plugins(or widgets) attach to. This is done by the mouse interaction handler plugin ($.ui.mouse) for the widgets. Instead the mouse plugin calls handlers for mouseStart, mouseDrag, mouseStop, and mouseCapture that the widgets override to handle mouse interactions.
I am not quite sure why that choice was made (http://groups.google.com/group/jquery-ui-dev/browse_thread/thread/ee35fd30ae7f7fe1) but apropos this problem, it seems an inconsistency introduced in jQuery 1.6 rc2.5 might explain atleast the behavior on Firefox. A change from jQuery 1.6rc2, the mouse plugin in 1.6rc2.5 doesn’t prevent the default action for mouseDown but does so for mouseUp.
With this information, here are the problems, causes, and solutions for the two browsers on which the draggable flash doesn’t work with by default :
Browser: Firefox 3
Problem: The video gets stuck to the cursor and continues to drag even after the primary primary mouse button is released.
Cause: The mouseup never reaches the draggable element (in my case, a div) which never receives a mouseUp event, and subsequently, doesn’t know when to stop dragging.
Solution: Attaching a mouseUp handler to the main video (”embed” in my case) tag and triggering a manual ‘mouseUp’ on the parent element from within the main video element’s mouseUp handler.
Browser: Safari 3
Problem:Controls on a draggable flash video do not respond. The video cannot be played or interacted with.
Cause: The major mouse events (mouseup, mousedown, click) never reach the flash video – which does respond to mouseOver and mouseOut though – and so the video is un-playable and un-interactable.
Solution: Change the jQuery-UI mouse plugin ( for jQuery-UI version 1.7.1: function _mouseUp in class $.ui.mouse in file ui.core.js) so that the mouseUp handler doesn’t prevent the default action for the mouseUp event. This is accomplished by changing the return value of the handler from false to true.
For a good introduction to events, you might want to read Peter-Paul Koch’s “Introduction to Events” at http://www.quirksmode.org/js/events_early.html. He also has very clearly-written and lucid introductions to various other front-end engineering concepts.
Finally, this problem is being tracked in jQuery-UI bug #3575 (http://dev.jqueryui.com/ticket/3575). I have submitted a fix for this problem in that bug (a patch on ui.core.js version 1.7.1) and hope it will get picked in the next release.