Ticket #4838 (closed bug: fixed)

Opened 5 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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>

Change History

comment:1 Changed 4 years ago by joern.zaefferer

  • Milestone changed from TBD to 1.8

comment:2 Changed 3 years ago by Scott González

  • Status changed from new to closed
  • Resolution set to fixed

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

comment:3 Changed 3 years ago by kborchers

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

comment:4 Changed 3 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.14
Note: See TracTickets for help on using tickets.