Search and Top Navigation
#7198 closed bug (fixed)
Opened March 24, 2011 09:56AM UTC
Closed October 12, 2012 12:34PM UTC
Last modified April 29, 2014 05:06AM UTC
Relative draggable helper offset incorrectly in Firefox when page is scrolled
Reported by: | GForster | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.draggable | Version: | 1.8.11 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When dragging an element with the style position:relative, the helper is offset from the mouse cursor by the amount the page is scrolled, when viewing the page in Firefox 3.6.16. IE8 and Chrome 10.0.648.151 have no problems.
I was eventually able to temporarily solve my problem by making the following change to the _getRelativeOffset function:
Instead of returning:
return { top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() };
I check browser version and return without the scrollparent offsets:
if ($.browser.mozilla) { return { top: p.top - (parseInt(this.helper.css("top"),10) || 0), left: p.left - (parseInt(this.helper.css("left"),10) || 0) }; } else { return { top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() }; }
Attachments (0)
Change History (9)
Changed April 05, 2011 03:23PM UTC by comment:1
Changed April 05, 2011 03:31PM UTC by comment:2
If someone provides a pull request that conforms to our coding standards (which includes not using browser sniffing), then it can land in 1.8.12. The jQuery UI team is not actively working on any interactions as we're focusing on the 1.9 release.
Changed June 27, 2012 08:50PM UTC by comment:3
Has there been any movement on this? It's still a defect in the most recent builds I've seen.
Changed October 11, 2012 02:49PM UTC by comment:4
milestone: | 1.9.0 → 2.0.0 |
---|
Changed October 12, 2012 06:10AM UTC by comment:5
I did some quick testing and it would appear the latest version of firefox (16.0.1) with Jquery UI 1.9.0, does not suffer from this issue.
Curiously I did note that the Jquery UI code does contain a number of instances of browser sniffing. Have the code standards changed over the course of nearly two years?
Changed October 12, 2012 12:34PM UTC by comment:6
milestone: | 2.0.0 → 1.9.0 |
---|---|
resolution: | → fixed |
status: | new → closed |
Curiously I did note that the Jquery UI code does contain a number of instances of browser sniffing. Have the code standards changed over the course of nearly two years?
No, but the code hasn't changed in even longer. All interaction plugins are being rewritten from scratch.
Changed February 22, 2014 04:37PM UTC by comment:7
As of 1.10.4 I'm still experiencing this issue.
The problem seems to be in jquery.ui.core.js, line 68 (https://github.com/jquery/jquery-ui/blob/1-10-stable/ui/jquery.ui.core.js), where static and relative properties are being grouped together. Relative positioning has the same effect on child element positioning as absolute positioning, so it should not be grouped with static positioning, which has a completely different effect on child element positioning.
I changed it in my copy of jQueryUI, removing "|relative" from "/static|relative/", and adding it to "/absolute/" (making it "/absolute|relative/"). It is now working great in my copy, although I'm only using the Sortable interaction, and haven't done any testing with any of the other interactions.
I went to fork the source code, but it has changed considerably since 1.10.4, so I'll wait until the new version is released so I can test it out before changing the code and making a pull request.
Changed February 23, 2014 09:26PM UTC by comment:8
Replying to [comment:7 leonjanzen]:
As of 1.10.4 I'm still experiencing this issue. The problem seems to be in jquery.ui.core.js, line 68 (https://github.com/jquery/jquery-ui/blob/1-10-stable/ui/jquery.ui.core.js), where static and relative properties are being grouped together. Relative positioning has the same effect on child element positioning as absolute positioning, so it should not be grouped with static positioning, which has a completely different effect on child element positioning. I changed it in my copy of jQueryUI, removing "|relative" from "/static|relative/", and adding it to "/absolute/" (making it "/absolute|relative/"). It is now working great in my copy, although I'm only using the Sortable interaction, and haven't done any testing with any of the other interactions. I went to fork the source code, but it has changed considerably since 1.10.4, so I'll wait until the new version is released so I can test it out before changing the code and making a pull request.
Hi leonjanzen,
If you would like us to look into this could you please create a test case that shows this bug. You can use this as a starting point: http://jsfiddle.net/tj_vantoll/fwk8R/.
Changed April 29, 2014 05:06AM UTC by comment:9
Thank you for the solution, it worked exactly as required.
Any chances to have that implemented in 1.8.12 as its bug?