0

I have some placeholder elements, which should not be used as drop location. Is there an option to disable some drop locations or to hide some drop locations? I know that you shouldn't do this

Do not add any child elements that aren't meant to be draggable

but isn't that, what accepts is for?

this.dragulaService.createGroup('cards', {
  accepts: (el, target, source, sibling) => {
    if (sibling !== null && sibling.classList.contains('invisible'))
      return false;

    return true;
  }
});

The issue is that target, and source are containers. I would need the new location as target, but the closest thing I've got is sibling (which is not what I want).

drop and over events also seem to take only containers into account.

Is there any solution for this?

Update:

Here is my workaround for this problem.

testing
  • 19,681
  • 50
  • 236
  • 417
  • Please create StackBlitz demo for this - I use very similar control with accepts and it is work, so you have an error in your implementation. – kris_IV May 20 '19 at 06:03
  • @kris_IV: I would have to create a separate MVCE, but I don't think `accepts` is the right one. Taken from the documentation: *You can set `accepts` to a method with the following signature: `(el, target, source, sibling)`. It'll be called to make sure that an element `el`, that came from container `source`, can be dropped on container `target` before a `sibling` element.* You only have container and sibling - this is not what I want. It should be dropped on any child div, if it hasn't the class `invisible`. – testing May 27 '19 at 07:18

0 Answers0