Skip to main content

Search and Top Navigation

#4838 closed bug (fixed)

Opened September 04, 2009 07:11PM UTC

Closed May 13, 2011 07:35PM UTC

Last modified May 13, 2011 07:36PM UTC

containment: 'document' is incorrect for top and left in draggable

Reported by: Lino Owned by:
Priority: major Milestone: 1.8.14
Component: ui.draggable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

In draggable when using {containment: 'document'}, the dragged element can be moved out of the page to the left and to the top.

I see this with jQuery UI 1.7.2 and also with the current SVN trunk, using Firefox 3.5.2.

Wild guess: this may be a side effect of changeset 211.

A simple example that demonstrates this problem:

<html>
    <head>
        <script src="jquery-1.3.2.min.js"></script>
        <script src="ui.core.js"></script>
        <script src="ui.draggable.js"></script>
    </head>
    <body>
        <p>
            Insert some space from the top of the page.
        </p>
        <p>
            <span style="background: red; color: white;">Drag me</span>
        </p>
        <script>
            $('span').draggable({containment: 'document'});
        </script>
    </body>
</html>
Attachments (0)
Change History (4)

Changed November 17, 2009 09:36AM UTC by jzaefferer comment:1

milestone: TBD1.8

Changed May 13, 2011 07:35PM UTC by Scott González comment:2

resolution: → fixed
status: newclosed

Merge pull request #266 from kborchers/bug_4838

Draggable: Changed logic to only subtract left and top offsets of containment if left and top are not already 0. Fixed #4838 - containment: 'document' is incorrect for top and left in draggable

Changeset: 2adfc03efee811f455a55e26eab9fff2a70a8093

Changed May 13, 2011 07:36PM UTC by kborchers comment:3

Draggable: Changed logic to only subtract left and top offsets of containment if left and top are not already 0. Fixed #4838 - containment: 'document' is incorrect for top and left in draggable

(cherry picked from commit 6e6d0b749c4724955a88a0a53ae1378391991064)

Changeset: 18669056957c49d5b72693a1d61d47f041d6e5ff

Changed May 13, 2011 07:36PM UTC by scottgonzalez comment:4

milestone: 1.91.8.14