Opened 8 years ago

Closed 5 years ago

#6869 closed bug (cantfix)

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)
                };
        },

Change History (5)

comment:1 Changed 8 years ago by ra

_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)
                };
        },

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

Milestone: 1.9.02.0.0

comment:3 Changed 7 years ago by mikesherov

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.

comment:4 Changed 7 years ago by mikesherov

Keywords: haspatch added
Summary: fix for nested margin "auto" cross browser compatibilityDraggable: nested margin "auto" causes drag to not scale properly in FF, IE

comment:5 Changed 5 years ago by mikesherov

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.

Note: See TracTickets for help on using tickets.