0

I'm attempting to create both a vertical and a horizontal list, and to add elements to them from an external source. The issue I'm encountering is that the horizontal dropzone isn't activating correctly. It functions well on the left side, but it doesn't work on the right side. Below is a simple example:

dnd example

I tried to deactivate first dropzone, when nested component is drag over, but my own event doesn't work.

Correct:

left side

Wrong:

right side

2
  • please give a more clear identification of the problem and the expected behavior. Commented Jan 19, 2024 at 12:42
  • if u take "second-item" and drag over nested dropzone. It doesn't active on right side (you need keep it over center or left side of dropzone). Commented Jan 19, 2024 at 12:45

1 Answer 1

0

You may disable the parent droppable while your mouse is over the child drop zone.

I defined a state called isDisabled and I set it to true onmouseenter the child and false after leaving.

And it worked as expected.

preview the fix here

Sign up to request clarification or add additional context in comments.

4 Comments

It's ok, but I see problem. Try add element before nested dropzone in vertical list. It's blocking potencial space.
ok, I've updated it, I tried to move the state down to the child, and while giving it the event onmousenter, it didn't work, so I defined a hook called useMouseBoundary that checks if the mouse is in the borders of the current div, it will disable the parent otherwise it will enable it. now it works fine you can try the same link.
the reason why it blocked potential space, is that at first I added the events to a div that is a parent of the child Droppable which contains the Group dropzone label, if you move it out. it will work fine too without using any custom hook.
This approach works well in the example above. However, if We assume there are additional subsections, they will be mutually exclusive

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.