Opened 8 years ago

Closed 19 months ago

Last modified 19 months ago

#5039 closed bug (fixed)

Sortable: does not account for scrolling in positioning

Reported by: kiechii Owned by: Alexander Schmitz
Priority: minor Milestone: 1.12.0
Component: ui.sortable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

in IE7 the jQuery UI is unable to detect page scroll. So if your page is scrolled down and you try to sort the list the item u are sorting will jump up.

For now I wrote a very ugly hack >.< to fix the issue. If anyone needs a temporary fix let me know I will post the ugly hack. But I rather prefer that the issue is fixed the proper way.

Change History (10)

comment:1 Changed 8 years ago by jazzyCamel

Problem also occurs in IE8, whats the ugly hack kiechii? Cheers

comment:2 Changed 8 years ago by Statocaster

I solved this problem by commenting out some lines in ui.sortable.js

Find these lines: (around line: 303 in 1.7.2 or around line: 331 in 1.8rc1)

$(this.helper).animate({
   left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
   top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)

and delete or comment out parts at the end of each line:

+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)

and

+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)

I tested it, and it works fine without those parts
(don't forget to keep the comma ',' after the first line (before the 'top' parameter))

comment:3 Changed 6 years ago by DSB

I had a similar issue with jquery ui 1.8.16 and IE 8. When the page is not at the top but scrolled down, the animation of the dropped sortable helper lets it flew to the bottom and out of the page.

The "ugly hack" did the trick for me and corrects the animation. It looks like cur.top and cur.left already hold the absolute offsets. There seems to be no need to add the relative offsets again which will result in too high values.

comment:4 Changed 5 years ago by Scott González

Milestone: TBD2.0.0

comment:5 Changed 5 years ago by mikesherov

Status: newopen
Summary: IE 7 Sortable BugSortable: does not account for scrolling in positioning

No test case, but this is the same issue as #5718

comment:6 Changed 5 years ago by tj.vantoll

#8812 is a duplicate of this ticket.

comment:7 Changed 5 years ago by tj.vantoll

#9082 is a duplicate of this ticket.

comment:8 Changed 5 years ago by tj.vantoll

Reduced test case against master from #9082: http://jsfiddle.net/wjxe4/37/.

comment:9 Changed 19 months ago by Alexander Schmitz

Owner: set to Alexander Schmitz
Resolution: fixed
Status: openclosed

In 9aca706:

Sortable: Update _contactContainers to use page clientX/Y values

The sortable was using the window position compared with page position to
determine where to drop objects. this was only a problem for sortables far
enough down to require scrolling.

Fixes #10727
Fixes #5039
Closes gh-1475
Closes gh-1585

comment:10 Changed 19 months ago by Scott González

Milestone: 2.0.01.12.0
Note: See TracTickets for help on using tickets.