Skip to main content

Search and Top Navigation

#6962 closed bug (worksforme)

Opened February 09, 2011 08:29PM UTC

Closed October 29, 2012 03:01PM UTC

jQuery UI sortable doesn't sort when it's handle is outside the container element

Reported by: Maher4Ever Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:
Description

Hello, I have a situation in which the sortable function stops working probably.

I have a dragging icon outside the dragged element, absolutely positioned. When I drag using this icon I get deferent behaviors across browsers.

In chrome, the placeholder appears and the div starts to "float", but the divs don't sort unless the cursor is inside the this div.

In FF the placeholder appears, the div starts to "float" and that's it. It just stays there until you release the dragging button.

I tried to minimize the code needed to produce this problem, here it is:

http://jsfiddle.net/u5kPn/3/

To know if it only happens with positions handles, I also tried to fix this by using floating and negative miraging to achieve the same layout, but that didn't help.

I hope this help you fix this problem.

Attachments (0)
Change History (6)

Changed February 11, 2011 09:21PM UTC by Maher4Ever comment:1

Is there something wrong with my bug submission? I saw that the developers has fixed some newer bugs in the recent "Recent Changes", so I thought there might be a problem with mine.

Changed February 11, 2011 09:32PM UTC by scottgonzalez comment:2

Well, in general 2 days is an extremely fast turn-around time on a bug. However, there is something specific about this bug that will cause it to not get any attention: the fact that it's a bug for sortable. Sortable, along with all of the other interaction plugins, is going to be rewritten from scratch for the 2.0 release, so we are not actively fixing bugs (any newly reported bug is almost guaranteed to be a long standing issue as these plugins are almost never touched). We're not happy about this situation, and we're very committed to rectifying this problem with the 2.0 release. However, if someone provides a reasonable patch, we will review it and land it if it works.

Changed February 12, 2011 06:51PM UTC by Maher4Ever comment:3

Thank you scott for your respond. After I knew that it might take a while for you guys to fix this, and scince I really need this to be fixed, I decided to dig deep into the source of sortable().

I found out that there is a problem calculating the 'this.offset.click.left' inside ' _intersectsWithPointer()'.

I didn't have enough time to find out why it being mis-calculated, so I just used a static fix for my website. Here it is:

// jQuery UI sortable fixer - dirty and static fix for now
$.extend($['ui']['sortable'].prototype, {
	_intersectsWithPointer: function(item) {

		var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
				isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left /* THIS IS THE FIX */ + 50 /* END FIX */, item.left, item.width),
				isOverElement = isOverElementHeight && isOverElementWidth,
				verticalDirection = this._getDragVerticalDirection(),
				horizontalDirection = this._getDragHorizontalDirection();

		if (!isOverElement)
				return false;

		return this.floating ?
				( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
				: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );

	}
});

I updated my example to show that it fixes the problem in my situation, here is the link: http://jsfiddle.net/MaherSalam/u5kPn/5/

I know this fix doesn't handle the source of the problem, but I hope it helps you guys even a little fixing it.

Changed February 14, 2011 01:53PM UTC by scottgonzalez comment:4

This doesn't seem valid. If the handles are outside of the element, why are you using pointer intersection?

Changed October 11, 2012 02:54PM UTC by scottgonzalez comment:5

milestone: 1.9.02.0.0

Changed October 29, 2012 03:01PM UTC by mikesherov comment:6

resolution: → worksforme
status: newclosed

Thanks for taking the time to contribute to the jQuery UI project! I can no longer reproduce the issue described. http://jsfiddle.net/u5kPn/3/

If you can still reproduce it, please feel free to reply to this ticket with a test case showing the problem. Thanks!