dnd icon indicating copy to clipboard operation
dnd copied to clipboard

Support overlapping Droppables via z-index prioritization

Open oliver-goh opened this issue 1 year ago • 1 comments

Expected behavior

Regarding Droppables that are overlapping, the Droppable with the highest z-index should be selected.

Related issues:

  • https://github.com/atlassian/react-beautiful-dnd/issues/655
  • https://github.com/hello-pangea/dnd/pull/196

Actual behavior

The library does not support such behaviour, as can be seen here, it uses getFurthestAway when there are multiple candidates.

Steps to reproduce

Droppable of the same type wrapped by a parent Droppable. See Before CodeSandbox in Demo

Suggested solution?

When there are multiple candidates, select candidate with highest zIndex. See https://github.com/hello-pangea/dnd/pull/669

What version of React are you using?

^17.0.0

What version of @hello-pangea/dnd are you running?

16.3.0

What browser are you using?

Google Chrome

Demo

Before

https://codesandbox.io/s/overlapping-droppables-before-hts23l

https://github.com/hello-pangea/dnd/assets/89013110/b1166b60-68bd-48fe-b19f-cae4a7ee0420

After

https://codesandbox.io/s/overlapping-droppables-z-index-n833f6

https://github.com/hello-pangea/dnd/assets/89013110/e5c3e36e-cdb1-4cb5-bbcb-efb81e050cc4

oliver-goh avatar Sep 12 '23 06:09 oliver-goh

@oliver-goh, thank you for your suggestion. I'll do some investigation and see what I can do. I'm not making any promises, but hopefully, we'll be able to make improvements to the dropping mechanism when this scenario presents itself.

100terres avatar Nov 11 '23 19:11 100terres