#9315 closed bug (fixed)
Draggable: jumps down with offset of scrollbar
Reported by: | j_geronimo | Owned by: | mikesherov |
---|---|---|---|
Priority: | blocker | Milestone: | 1.11.0 |
Component: | ui.draggable | Version: | 1.10.3 |
Keywords: | regression | Cc: | |
Blocked by: | Blocking: |
Description
That appears only with using UI 1.10.3 and when the scrollbar is not at the very top in Firefox, Opera, IE8.
In Chrome works fine and also with 1.10.2 on other browsers.
The UI dialog demo page has this bug too:
- drag the dialog down until appears the scrollbar
- scroll down
- again drag the dialog down.
- dialog goes down with the offset
Change History (66)
comment:1 Changed 10 years ago by
Status: | new → open |
---|
comment:2 Changed 10 years ago by
This seems like the most likely ticket that caused the change in behavior http://bugs.jqueryui.com/ticket/6258, but I haven't confirmed that yet.
comment:4 Changed 10 years ago by
Another test case from #9320: http://jsfiddle.net/tj_vantoll/7sU9L/. Works fine in Chrome/Safari and in all browsers in 1.10.2. Fails in Firefox/Opera on 1.10.3.
comment:6 Changed 10 years ago by
Keywords: | regression added |
---|---|
Milestone: | none → 1.11.0 |
Priority: | minor → blocker |
comment:7 Changed 10 years ago by
Owner: | set to mikesherov |
---|---|
Status: | open → assigned |
comment:9 Changed 10 years ago by
Draggable is affected since 1.10.3, simple demo here
no scrolling before dragging, clone is ok scrolling down before dragging, clone is ko
when no clone, no bug.
comment:11 Changed 10 years ago by
Component: | ui.dialog → ui.draggable |
---|---|
Summary: | Draggable dialog jumps down with offset of scrollbar → Draggable: jumps down with offset of scrollbar |
I'm moving this ticket to ui.draggable it's a generic problem than just dialogs.
comment:13 follow-up: 14 Changed 10 years ago by
Do we currently have any workaround for this issue?
comment:14 Changed 10 years ago by
comment:19 Changed 10 years ago by
Keywords: | blink added |
---|
Ultimately, this needs to needs to be fixed in blink, and is caused by https://code.google.com/p/chromium/issues/detail?id=157855 I'll workaround it for now, but this should be fixed upstream.
comment:20 Changed 10 years ago by
I found this as well, in my test it happens in all IE browsers (8/9/10) and FF: here's the test: http://jsbin.com/idofoq/4/edit
comment:21 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Draggable: Ignore scroll offsets for abspos draggables. Fixes #9315 - Draggable: jumps down with offset of scrollbar
Changeset: 263d07894493aafcdc6a565f9f9c079b4b8f5d80
comment:22 Changed 10 years ago by
I believe this affects ui.sortable as well.
Check with Firefox/IE. Scroll down then drag one of the elements. http://jsfiddle.net/7AxXE/9/
comment:24 follow-up: 25 Changed 10 years ago by
Hi,
changeset 263d07894493aafcdc6a565f9f9c079b4b8f5d80 does not solve the problem for me (http://jsfiddle.net/Sce5e/1/).
The workaround I found is to replace
if (!this.offset.scroll) {
by
if (!this.offset.scroll || scroll.scrollTop() != this.offset.scroll.top || scroll.scrollLeft() != this.offset.scroll.left) {
in the implementations of _convertPositionTo and _generatePosition in jquery.ui.draggable.js.
The execution is probably even faster if the condition is removed so that this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
is always executed.
Indeed, this.offset.scroll is never updated when the page/container is scrolled (it is only set once when dragging starts and this.offset.scroll is false). In version 1.10.2, the returned values are calculated using scroll.scrollTop() and scroll.scrollLeft() in the return statement instead of using the (fixed) values from this.offset.scroll as it is in version 1.10.3.
comment:25 follow-up: 26 Changed 10 years ago by
Replying to tkhyn:
Hi,
changeset 263d07894493aafcdc6a565f9f9c079b4b8f5d80 does not solve the problem for me (http://jsfiddle.net/Sce5e/1/).
The workaround I found is to replace
if (!this.offset.scroll) {
by
if (!this.offset.scroll || scroll.scrollTop() != this.offset.scroll.top || scroll.scrollLeft() != this.offset.scroll.left) {
in the implementations of _convertPositionTo and _generatePosition in jquery.ui.draggable.js. The execution is probably even faster if the condition is removed so that
this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()};
is always executed.Indeed, this.offset.scroll is never updated when the page/container is scrolled (it is only set once when dragging starts and this.offset.scroll is false). In version 1.10.2, the returned values are calculated using scroll.scrollTop() and scroll.scrollLeft() in the return statement instead of using the (fixed) values from this.offset.scroll as it is in version 1.10.3.
263d07894493aafcdc6a565f9f9c079b4b8f5d80 is in master and slated for 1.11. It is not in 1.10.3 which your test case is using.
comment:26 follow-up: 27 Changed 10 years ago by
Replying to tj.vantoll:
263d07894493aafcdc6a565f9f9c079b4b8f5d80 is in master and slated for 1.11. It is not in 1.10.3 which your test case is using.
I'm aware of that, thanks. The test case is only there to show you the code I was using, as I had no knowledge of a way to include the master version in jsfiddle.
To test if the changeset fixed the problem, I got the draggable.js from the master and tested it on my machine. This did not fix the problem, and this is normal as the changeset does not correct the issue I explain in the above message.
In my opinion, this ticket should therefore be reopeoned.
EDIT : found a way to include jquery-ui master (sorry, I should have tried to do that before). Edited my fiddle accordingly http://jsfiddle.net/Sce5e/4/. Bug still there
comment:27 follow-up: 28 Changed 10 years ago by
Replying to tkhyn:
Replying to tj.vantoll:
263d07894493aafcdc6a565f9f9c079b4b8f5d80 is in master and slated for 1.11. It is not in 1.10.3 which your test case is using.
I'm aware of that, thanks. The test case is only there to show you the code I was using, as I had no knowledge of a way to include the master version in jsfiddle.
To test if the changeset fixed the problem, I got the draggable.js from the master and tested it on my machine. This did not fix the problem, and this is normal as the changeset does not correct the issue I explain in the above message.
In my opinion, this ticket should therefore be reopeoned.
EDIT : found a way to include jquery-ui master (sorry, I should have tried to do that before). Edited my fiddle accordingly http://jsfiddle.net/Sce5e/4/. Bug still there
Ok, I see the behavior and that it did not occur in 1.10.2 and does in 1.10.3 and master: http://jsfiddle.net/tj_vantoll/c4CDc/
This only seems to occur when top: 0
, bottom: 0
, and overflow: auto
are applied to the wrapper. If I remove any of those the issue is not present.
Although this is very similar I think this is a different problem. The bug for this ticket occurred only in Firefox and IE and your test case seems problematic in all browsers.
Could you explain why you need overflow: auto
in your test case? And then we'll probably want to create a new ticket for your problem.
Thanks.
comment:28 follow-up: 29 Changed 10 years ago by
Replying to tj.vantoll:
Could you explain why you need
overflow: auto
in your test case? And then we'll probably want to create a new ticket for your problem.
In my case I want only the #page_wrapper and not the body to be scrollable, so that the header is kept out of the scrollable area (and the scrollbar). It may be achieved in another way in my particular case to make the draggables work but the bug seems to affect any draggable inside an absolutely positioned scrollable element (which is not that uncommon I guess).
Sorry for having 'polluted' this ticket with an issue which - after a second reading - is indeed different and would definitely deserve a new ticket. I had read too many tickets about scrolling and draggables before posting and landed here :).
comment:29 Changed 10 years ago by
Replying to tkhyn:
Replying to tj.vantoll:
Could you explain why you need
overflow: auto
in your test case? And then we'll probably want to create a new ticket for your problem.In my case I want only the #page_wrapper and not the body to be scrollable, so that the header is kept out of the scrollable area (and the scrollbar). It may be achieved in another way in my particular case to make the draggables work but the bug seems to affect any draggable inside an absolutely positioned scrollable element (which is not that uncommon I guess).
Sorry for having 'polluted' this ticket with an issue which - after a second reading - is indeed different and would definitely deserve a new ticket. I had read too many tickets about scrolling and draggables before posting and landed here :).
Thanks, that helps. Actually what you're experiencing is covered by #9379. I'll add your test case there.
comment:34 Changed 9 years ago by
Keywords: | blink removed |
---|
This is now fixed in Webkit and Blink: https://bugs.webkit.org/show_bug.cgi?id=106133 and https://code.google.com/p/chromium/issues/detail?id=157855
comment:44 Changed 9 years ago by
Something in Chrome seems to have changed to break this again. To observe the broken behaviour in Chrome v32.0.1700.107, go to ThemeRoller (http://jqueryui.com/themeroller/) and open a dialog box. The box will jump down the page when you click on the drag handle.
comment:52 Changed 9 years ago by
Replying to cyxjqui:
1.10.4 still has this problem, it is not fixed
As the milestone says, the fix will be released in 1.11.0.
comment:62 follow-up: 63 Changed 9 years ago by
Using ui 1.11.0 this issue still occurs in chrome Version 35.0.1916.153
comment:63 Changed 9 years ago by
Replying to barb:
Using ui 1.11.0 this issue still occurs in chrome Version 35.0.1916.153
Please include a test case that shows the issue.
comment:64 Changed 9 years ago by
Hello,
The other workaround is, you can use user agent and find the browser, apply the style
html, body { position:relative; }
If anyone have a better workaround, please post.
Thanks
comment:65 Changed 8 years ago by
The above workaround by arjun didn't work in all browsers for me. As of today (March 9, 2015), the following CSS is the best workaround I've found. This works for all major browsers I've tested (Firefox, Chrome, Opera, Safari, IE11, IE10). It does NOT work for Internet Explorer 9 and below - I just disable the draggables for old IE:
/* * Hack to fix weird jquery ui draggable 'containment' issue when page is not scrolled to top * See http://bugs.jqueryui.com/ticket/9315 */ @media screen and (-webkit-min-device-pixel-ratio:0) { /* chrome */ html{ position: relative; } } @-moz-document url-prefix() { /* firefox */ body{ position: relative; overflow: auto; } } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { /* ie10+ */ body{ position: relative; overflow: auto; } }
comment:66 Changed 5 years ago by
Nothing above worked for us in any version of 1.10.x. The following CSS solved it though.
Our issue was mostly in Chrome if you're scrolled down the page and using the draggable:
header, nav, main, footer, article, section, summary{ position: relative; }
I can confirm this issue and that it is a 1.10.3 regression. This is likely a draggable issue so I want to try to recreate this without a dialog. Hopefully that will help to pin down which of the 6 draggable fixes that landed in 1.10.3 might be suspect.