Skip to main content

Search and Top Navigation

#3882 closed bug (fixed)

Opened January 20, 2009 01:26PM UTC

Closed February 19, 2009 02:50AM UTC

Last modified January 17, 2010 05:59AM UTC

Resizable - Left Margin Calculated Incorrectly (Using Containment)

Reported by: braddunbar Owned by: scottgonzalez
Priority: critical Milestone: 1.7
Component: ui.resizable Version: 1.6rc5
Keywords: Containment Cc:
Blocked by: Blocking:
Description

When using containment, the right side of a resizable does not stop at the edge of the containment. It stops at the left offset of the containment element.

A revised version of the basic resizable demo is included to demonstrate this. The only changes are to the containing div.demo, and the containment option.

I believe this is due to the calculation of

woset
in the containment plugin.

Attachments (2)
  • default.html (1.2 KB) - added by braddunbar January 30, 2009 04:51PM UTC.

    Demo with "postion: relative;" on ".demo" element

  • ui.resizable.js (25.1 KB) - added by braddunbar January 30, 2009 05:30PM UTC.

    Include check for absolutely positioned parent

Change History (8)

Changed January 20, 2009 10:25PM UTC by scottgonzalez comment:1

milestone: TBD1.6
priority: minorcritical

Changed January 27, 2009 05:15AM UTC by eduardo comment:2

resolution: → fixed
status: newclosed

Fixed when #3733 was fixed

Changed January 30, 2009 04:53PM UTC by braddunbar comment:3

If the ".demo" element has "position:relative;" then the incorrect behavior is still present.

I am continuing to look into this.

Changed January 30, 2009 05:05PM UTC by rdworth comment:4

resolution: fixed
status: closedreopened

Changed January 30, 2009 05:21PM UTC by braddunbar comment:5

When the container element is positioned relatively and is also the parent of the resizable element, woset should not include the container offset.

I added the following lines starting at line number 706 to fix this issue:

var isParent = self.containerElement.get(0) == self.element.parent().get(0),
    isParentRelative = self.containerElement.css('position') == 'relative';

if(isParent && isParentRelative) woset -= self.parentData.left;

The

isParent
and
isParentRelative
checks should be placed in the
start
function to prevent calling them over and over, but I thought including them here would make the concept easier to grok.

Note that this may also be the case for absolutely positioned parent elements. I will look into this.

Changed January 30, 2009 05:31PM UTC by braddunbar comment:6

This does indeed seem to affect absolutely positioned parent containers, changing the patch code to:

var isParent = self.containerElement.get(0) == self.element.parent().get(0),
    isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));

if(isParent && isOffsetRelative) woset -= self.parentData.left;

Changed February 18, 2009 06:13PM UTC by rdworth comment:7

owner: → scott.gonzalez
status: reopenedassigned

Changed February 19, 2009 02:50AM UTC by scottgonzalez comment:8

resolution: → fixed
status: assignedclosed

Fixed in r2107. Thanks for the patch.