Code Monkey home page Code Monkey logo

Comments (7)

Arthur-Ruthenberg avatar Arthur-Ruthenberg commented on May 22, 2024

It's reported that this happens. I am also aware that there can only be one instance of html5 backend on the page at once.

I found out that in one of the latest updates the HTML5Backend dependance that they use here it is possible to pass a root element that will allow 'localization' of this behavior only to the chosen component.

Hopefully someone can fix it.

from react-arborist.

jameskerr avatar jameskerr commented on May 22, 2024

@Arthur-Ruthenberg thanks for the comment. Because I don't feel like I fully caught your message, let me ask: are you having this problem in your app with react-arborist? Or are you helping suggest a solution for how we might fix this?

from react-arborist.

Arthur-Ruthenberg avatar Arthur-Ruthenberg commented on May 22, 2024

@jameskerr
Both.
I was trying to implement a simple dragging of an element in my project (I also have implemented the react-arborist there) and I stumbled upon this problem. The native onDrag event is being blocked by react-dnd-HTML5Backend library.
This library puts an event listener on the window.onDragStart which blocks any subsequent onDrag events.

I dug a little further within the react-dnd-HTML5Backend and they said there that sometime during the 2021 they made an improvement to the library to allow passing of a 'root' object to the dnd provider and it is supposed to fix this bug.

from react-arborist.

jameskerr avatar jameskerr commented on May 22, 2024

Thank you for the research. Now I understand the issue. I do know of the "root" option you are referring to. If you are in a hurry, I'd welcome a contribution to react-arborist that adds a "dndRoot" option to the props and passes it to the react-dnd provider. Otherwise, I'll work on this as I have time. Thanks for your help!

from react-arborist.

jameskerr avatar jameskerr commented on May 22, 2024

This is an issue with reactDnd: react-dnd/react-dnd#3344 This is unfortunate.

I will add a prop to the Tree component called dndRootElement so that you can scope the drag listeners to whatever element you want. If none is specified, it will default to window.

from react-arborist.

jameskerr avatar jameskerr commented on May 22, 2024

@Arthur-Ruthenberg in the latest release (version 1.1.0) you can pass a dndRootElement prop to the tree to scope the event listeners. Let me know if that works for you!

from react-arborist.

Arthur-Ruthenberg avatar Arthur-Ruthenberg commented on May 22, 2024

@jameskerr Thank you!
I will check it out ASAP!
I actually wanted to do it myself next weekend, but you beat me to it

from react-arborist.

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.