Giter VIP home page Giter VIP logo

Comments (7)

nelix avatar nelix commented on May 6, 2024

You could try adding event.stopPropagation() to the over dropTarget event, we can consider this as default behaviour for version 1.0

from react-dnd.

nelix avatar nelix commented on May 6, 2024
dropTarget: {
  over(component, item, e) {
    e.stopPropagation();
  }
}

I have not had time to try my self however

from react-dnd.

deser avatar deser commented on May 6, 2024

OK, I'll try thanks a lot!

from react-dnd.

gaearon avatar gaearon commented on May 6, 2024

I don't think this will work. Drop state is determined by drop target type and enter/leave events.

Either way, it's not recommended to call stopPropagation yourself. We will probably remove e in future altogether because that exposes internal implementation and encourages dirty workarounds.

There are both cases when you want this nesting behavior and cases when you don't. Currently you can implement canDrop on parent components and return false if you know there's an active child handling them already. This will require manually telling parent that child is active from child's enter and leave events.

A better way would be to mirror what we do with acceptDrop. It receives isHandled which tells whether there is a child that already handled drop. Perhaps we should have a similar parameter for canDrop: canDrop(component, item, isHandled). Parent components can then decide whether they want to activate if they know some child is already active.

from react-dnd.

deser avatar deser commented on May 6, 2024

ishandled inside candrop on my mind is the best solution

from react-dnd.

gaearon avatar gaearon commented on May 6, 2024

If you'd like to make a PR, go for it! We're a bit busy with large-scale refactoring so it's going to take some time to add this.

from react-dnd.

gaearon avatar gaearon commented on May 6, 2024

This issue is superseded by #87. I'll close it, please let's continue the discussion there!

from react-dnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.