Skip to main content

Search and Top Navigation

#6869 closed bug (cantfix)

Opened January 17, 2011 03:45PM UTC

Closed August 16, 2014 06:18PM UTC

Draggable: nested margin "auto" causes drag to not scale properly in FF, IE

Reported by: ra Owned by:
Priority: minor Milestone: 1.11.2
Component: ui.draggable Version: 1.8.8
Keywords: haspatch Cc:
Blocked by: Blocking:
Description

EXAMPLE: http://jsfiddle.net/9q6wQ/

SUBJECT: draggable nested div with "auto" margins

PROBLEM: computed margin values from "auto" margin are added to left/top coordinates instead of margin-left and margin-top. Works fine in Chrome and Safari. Gets jumpy with FF, Opera and IE.

FIX: instead of returning 0 as margin-left/margin-top and adding the amount of margin to the left/top position of the element, should return calculated margin-left/margin-top value.

CURRENT CODE:

        _cacheMargins: function() {
                this.margins = {
                        left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
                        top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
                };
        },

FIX:

        _cacheMargins: function() {
                this.margins = {
                        left: (parseInt(this.element.css("marginLeft"),10) || (this.offset.left-parseInt(this.element[0].style.left,10)) || 0),
                        top: (parseInt(this.element.css("marginTop"),10) || (this.offset.top-parseInt(this.element[0].style.top,10)) || 0)
                };
        },

Attachments (0)
Change History (5)

Changed January 17, 2011 03:54PM UTC by ra comment:1

_cacheMargins: function() {
                this.margins = {
                        left: (parseInt(this.element.css("marginLeft"),10) || (this.element.offset().left-parseInt(this.element[0].style.left,10)) || 0),
                        top: (parseInt(this.element.css("marginTop"),10) || (this.element.offset().top-parseInt(this.element[0].style.top,10)) || 0)
                };
        },

Changed October 11, 2012 02:49PM UTC by scottgonzalez comment:2

milestone: 1.9.02.0.0

Changed October 26, 2012 05:30AM UTC by mikesherov comment:3

status: newopen

confirmed on latest: http://jsfiddle.net/cmjMk/

However, the proposed fix isn't really safe either considering .style.left only captures inline styles. This might end up being a can't fix here, but for now, I'll mark as open.

Changed October 28, 2012 09:03PM UTC by mikesherov comment:4

keywords: → haspatch
summary: fix for nested margin "auto" cross browser compatibilityDraggable: nested margin "auto" causes drag to not scale properly in FF, IE

Changed August 16, 2014 06:18PM UTC by mikesherov comment:5

milestone: 2.0.01.11.2
resolution: → cantfix
status: openclosed

This is a cantfix, unfortunately. All browsers except FF have implemented the fixes necessary: https://bugzilla.mozilla.org/show_bug.cgi?id=381328

I'll continue to advocate at that level, but nothing more I can do here.