angular-drag-and-drop-lists icon indicating copy to clipboard operation
angular-drag-and-drop-lists copied to clipboard

Bootstrap dropdown does not work inside draggable element

Open ianmh opened this issue 9 years ago • 8 comments

I'm assuming this is because the Bootstrap dropdowns use list elements. Is there a workaround for this?

ianmh avatar Apr 12 '16 21:04 ianmh

So I have narrowed down the issue to this piece of code. The event.stopPropagation(); is preventing events from registering with Bootstrap UI dropdowns. I have removed this line in my code but I'm not sure of the implications.

I should also add that not only do they work inside draggable elements now, but also when you click on a draggable element Bootstrap drop downs now properly close if they were open. I use a Bootstrap dropdown to also add draggable elements, before this change they would not close if you clicked on a draggable element.

      /**
       * When the element is clicked we invoke the callback function
       * specified with the dnd-selected attribute.
       */
      element.on('click', function(event) {
        if (!attr.dndSelected) return;

        event = event.originalEvent || event;
        scope.$apply(function() {
          $parse(attr.dndSelected)(scope, {event: event});
        });

        // Prevent triggering dndSelected in parent elements.
        // event.stopPropagation();
      });

https://github.com/marceljuenemann/angular-drag-and-drop-lists/blob/master/angular-drag-and-drop-lists.js#L169

ianmh avatar Apr 15 '16 20:04 ianmh

This issue is fixed with this pull request by rysilva.

https://github.com/marceljuenemann/angular-drag-and-drop-lists/pull/132/commits/4a788552dec7730e656677a7ca33f9c8688a5406

Update: Correction, this does not fix the issue.

ianmh avatar May 24 '16 21:05 ianmh

Same here, @ianmh any workarounds?

Den-dp avatar Dec 20 '16 18:12 Den-dp

@Den-dp I can't seem to duplicate the issue I was having anymore, but I have used dnd-nodrag attribute on the dropdowns. This might fix it.

ianmh avatar Dec 20 '16 19:12 ianmh

It's still pretty simple to reproduce http://plnkr.co/edit/nuQ8QQr3NsSPv6Cs1N8G?p=preview

Den-dp avatar Dec 21 '16 17:12 Den-dp

Your example works for me, although they don't toggle / close, is that the issue?

Edit: I'm using a really old version of bootstrap and dropdown-toggle is working for me.

ianmh avatar Dec 21 '16 18:12 ianmh

although they don't toggle / close, is that the issue?

Yes, this is my issue.

I'm using a really old version of bootstrap and dropdown-toggle is working for me.

Hey, but what about living on the bleeding edge? 😉

Den-dp avatar Dec 21 '16 18:12 Den-dp

Any updates on this?

mshriner avatar Jul 10 '19 15:07 mshriner