Skip to main content

Search and Top Navigation

#10212 closed bug (fixed)

Opened July 15, 2014 05:20PM UTC

Closed July 15, 2014 07:50PM UTC

Last modified July 15, 2014 07:52PM UTC

Draggable: ui-draggable-handle class is added to all matching elements on the page

Reported by: mizzao Owned by: tj.vantoll
Priority: minor Milestone: 1.11.1
Component: ui.draggable Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:
Description

I had a page with a lot of potential draggables and dynamic changes using Meteor, so instead of activating the draggable methods all at once, I created them on mouseenter and destroyed them on mouseleave.

While this adds and removes the ui-draggable class correctly as elements are moused over, the ui-draggable-handle is added to all matching handle elements on the page as soon as any draggable is moused over. The class is still removed on an individual destroy.

To see this, go to this fiddle and mouse over the elements with their classes visible in Chrome's developer tools.

http://jsfiddle.net/4zE3p/ or http://jsfiddle.net/4zE3p/embedded/result/

This appears to occur from https://github.com/jquery/jquery-ui/blob/1.11.0/ui/draggable.js#L318 where if a selector like ".handle" is passed in as an option, $(".handle") is going to select all handles on the page - instead of just one descendant handle. This behavior did not occur in 1.10.4 as there was no ui-draggable-handle class used in that release.

Moreover, setting {addClasses: false} does not disable this behavior because _setHandleClassName does not check the value of addClasses: https://github.com/jquery/jquery-ui/blob/1.11.0/ui/draggable.js#L73

Attachments (0)
Change History (4)

Changed July 15, 2014 05:26PM UTC by tj.vantoll comment:1

owner: → tj.vantoll
status: newassigned
summary: ui-draggable-handle class is added to all matching elements on the pageDraggable: ui-draggable-handle class is added to all matching elements on the page

Thanks mizzao. The query to find handles should search within the element and not globally. I can patch this.

Changed July 15, 2014 05:39PM UTC by tj.vantoll comment:2

Changed July 15, 2014 07:50PM UTC by TJ VanToll comment:3

resolution: → fixed
status: assignedclosed

Draggable: Only apply ui-draggable-handle within the draggable instance

Fixes #10212

Closes gh-1284

Changeset: 7594a3142547e078326872cb0d6e2d7f32f4c808

Changed July 15, 2014 07:52PM UTC by tj.vantoll comment:4

milestone: none1.11.1