Skip to main content

Search and Top Navigation

#6085 closed bug (fixed)

Opened September 20, 2010 07:17PM UTC

Closed November 21, 2011 09:17PM UTC

Last modified April 15, 2013 11:39AM UTC

Parent droppable takes precedence over dynamically created child droppable

Reported by: sslotsky Owned by:
Priority: minor Milestone: 1.8.17
Component: ui.droppable Version: 1.8
Keywords: Cc:
Blocked by: Blocking:
Description

If a container is droppable, then if a dynamically created element is placed within the container and made to be droppable, the parent container always takes precedence, so the drop event for the new droppable never fires.

To see this, open the attached html file in your browser and fix the reference to jquery-ui.

1. Drag the 'Drag me!' text into the container. After reading the alert, an orange box will append to the container. The orange box should be droppable.

2. Drag the 'Drag me!' text into the orange box. The same alert as you saw in step 1 will occur, and a new orange box will be appended. This indicates that the drop function for the container fired, but the drop function for the orange box did not.

Please note that the 'refreshPositions' option does not solve this problem.

Attachments (1)
  • precedence.html (1.2 KB) - added by sslotsky September 20, 2010 07:17PM UTC.
Change History (15)

Changed September 20, 2010 07:36PM UTC by scottgonzalez comment:1

milestone: TBD1.9

This apparently broke somewhere between 1.7.2 and 1.8.0. Setting greedy to true does cause the in droppable to get activated, though it also properly prevents the outer droppable from being activated. With greedy false, both should get activated and only the outer does.

Changed September 20, 2010 07:38PM UTC by scottgonzalez comment:2

version: 1.8.41.8

Changed January 05, 2011 08:51PM UTC by sslotsky comment:3

Apparently the attachments have been removed and I don't currently have any copies to post on jsFiddle... I'll work something up when I can.

Changed January 05, 2011 09:01PM UTC by scottgonzalez comment:4

The attachment works fine for me.

Changed January 05, 2011 09:17PM UTC by sslotsky comment:5

Well in any case, I've created a jsFiddle:

http://jsfiddle.net/ahqQg/1/

Instructions are the same as in the bug description.

Changed October 13, 2011 08:55PM UTC by bikeshedder comment:6

I just stumbled across the same issue and prepared a test case for this. This is probably related to #6009.

http://jsfiddle.net/PHQHb/5/

Changed October 22, 2011 11:02AM UTC by bikeshedder comment:7

Annoying issue, simple fix: https://github.com/jquery/jquery-ui/pull/499

Changed November 21, 2011 09:17PM UTC by Michael P. Jung comment:8

resolution: → fixed
status: newclosed

Droppable: Make sure._drop is called for all relevant droppables. Fixes #6009 - Upper droppable should receive draggable. Fixes #6085 - Parent droppable takes precedence over dynamically created child droppable.

Changeset: fdc332ed5fb7f7e688151d5cae9b450569d73da5

Changed November 21, 2011 09:18PM UTC by Michael P. Jung comment:9

Droppable: Make sure._drop is called for all relevant droppables. Fixes #6009 - Upper droppable should receive draggable. Fixes #6085 - Parent droppable takes precedence over dynamically created child droppable.

(cherry picked from commit fdc332ed5fb7f7e688151d5cae9b450569d73da5)

Changeset: f7b28df28809bca05623b7394919d15919334afb

Changed November 21, 2011 09:19PM UTC by scottgonzalez comment:10

milestone: 1.91.8.17

Changed December 11, 2011 06:24AM UTC by tabiul comment:11

I do not think the fix solves the issue that is raised by this ticket. It seems to fix the issue where the parent droppable should receive precedence overchild droppable. The issue that I and the author for this ticket is facing is that when a dynamically created droppable is added to pre-existing droppable then the new child droppable never get focus. All the draggable seem to be consumed by the parent droppable.

Changed December 12, 2011 09:59PM UTC by sslotsky comment:12

tabiul is correct. Please see the jsfiddle at http://jsfiddle.net/PHQHb/5/, this issue is *not* fixed.

Changed December 13, 2011 01:25PM UTC by scottgonzalez comment:13

This is fixed. You're still testing against 1.8.16, which does not contain the fix.

Changed April 15, 2013 10:20AM UTC by daia comment:14

_comment0: Replying to [comment:12 sslotsky]: \ > tabiul is correct. Please see the jsfiddle at http://jsfiddle.net/PHQHb/5/, this issue is *not* fixed. \ \ Was it fixed?1366021274179194

Was it fixed?

Changed April 15, 2013 11:39AM UTC by scottgonzalez comment:15

Yes. Did you read my response?