#9733 closed bug (fixed)
Draggable: Changing containment option doesn't work
Reported by: | benth | Owned by: | benth |
---|---|---|---|
Priority: | minor | Milestone: | 1.11.0 |
Component: | ui.draggable | Version: | 1.10.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If containment is such that relative_container is set, and then containment changes e.g. to 'window', the old relative_container will remain instead of being unset.
Change History (9)
comment:1 Changed 9 years ago by
Owner: | set to benth |
---|---|
Status: | new → pending |
comment:2 follow-up: 3 Changed 9 years ago by
Status: | pending → new |
---|
I have a draggable element that had its containment set to another DOM element, but later would get set to 'window'. After that, if I was scrolled down the page, and started dragging the element, the element would skip up. I found that relative_container was set to the old containment.
relative_container is only set in _setContainer, at the end, but there are many code paths in _setContainer that return early. I fixed my problem by setting relative_container to null for all these paths.
You'll have to wait for a test case.
comment:3 Changed 9 years ago by
Status: | new → pending |
---|
Replying to benth:
You'll have to wait for a test case.
We need one to look into this. You can use this as a starting point: http://jsfiddle.net/tj_vantoll/fwk8R/.
comment:5 Changed 9 years ago by
Status: | new → pending |
---|
You forgot to click Update in order to generate your fiddle. That's just a copy of the original fiddle that tj.vantoll provided.
comment:7 Changed 9 years ago by
Status: | new → open |
---|---|
Summary: | Draggable: relative_container fails to get unset when containment changes → Draggable: Changing containment option doesn't work |
comment:8 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Draggable: fix changing containment
If containment was set such that relative_container is set by _setContainment, and then containment changes to e.g. "document", "window", or an array, relative_container would not be unset, causing incorrect containment of the draggable.
Add a unittest to check that containment with an array works after previously being set to "parent".
Fixes #9733 Closes gh-1176
Changeset: 0bb807bb42af87bf4c6dd4d71808b12c08d316e7
comment:9 Changed 9 years ago by
Milestone: | none → 1.11.0 |
---|
Please provide a reduced test case showing the problem. Describe what you're doing, not the internal code.