Opened 6 years ago

Last modified 6 years ago

#9033 open bug

Resizable: absolutely positioned element incorrectly set to left position of 'auto'

Reported by: mashdraggin Owned by:
Priority: minor Milestone: none
Component: ui.resizable Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:

Description

Resizing an element that is positioned absolutely in jQuery UI 1.10.0 can result in the element's "left" style being incorrectly set to "auto" when attempting to resize it. This issue was introduced in jQuery UI 1.10.0. It is not present in jQuery UI 1.9.x. It is easily reproducible by setting an element to be positioned absolutely and with its "left" css property > 0, and then applying the resizable widget and attempting to resize it. In the above scenario the element will 'jump' to the left due to its left position being set to auto.

The behavior was observed in the Google Chrome browser, version 24.0.1312.56 m on Windows 7 x64.

The code in question appears from inline comments to have been introduced for ticket 1749. In jQuery UI 1.9.2 it is in the jquery.ui.resizable.js file, from ~lines 242-244. In jQuery UI 1.10.0 it is from ~ lines 276-280. For some reason the code-block for this bugfix was changed.

The change specifically introducing the error, which sets absolute element's position, was adding the following ( ~ lines 277-278 ):

if ((/absolute/).test(el.css("position"))) {
  el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });

You can view the bug by attempting to resize the black div to the left, on jsFiddle here

You can view the correct behavior here (jQuery UI 1.9.0)

Change History (1)

comment:1 Changed 6 years ago by tj.vantoll

Component: ui.coreui.resizable
Status: newopen
Summary: resizing absolutely positioned element incorrectly sets left position to 'auto'Resizable: absolutely positioned element incorrectly set to left position of 'auto'

Confirmed. I had previously thought this was related to #7772 but it appears not to be if this wasn't an issue in 1.9.X. Here's another test case showing the issue against master - http://jsfiddle.net/tj_vantoll/3Rzsu/.

Note: See TracTickets for help on using tickets.