Giter VIP home page Giter VIP logo

Comments (3)

JakeSidSmith avatar JakeSidSmith commented on May 24, 2024

Hi, @mayheadd. Do you mean you'd like to have a "handle" that is the only part that can be dragged to reorder? This is not currently possible, but I'm in the middle of a re-write (which has pivoted quite a lot), and so this feature should be available in the future.

I'd suggest finding another library for now if you require this ability.

from react-reorder.

avbentem avatar avbentem commented on May 24, 2024

Just for future readers, one might not need another library with either of the following workarounds:

  • Use the disabled prop to only enable the component after an onMouseDown event on some drag handle icon occurred, assuming that also fires on touch. Next, disable it again in onReorder (which only fires if reordering truly happened), and when somehow detecting the mouse outside of the icon.

    (Using both onMouseEnter and onTouchStart along with onMouseLeave and onTouchEnd might be easier. But that needs proper testing on touch devices, and needs testing with blurring due to, e.g., moving the mouse away from the icon after first switching to a different window with they keyboard. Also, keyboard navigation needs to be tested. Note that changing disabled while already dragging has no effect, so one can safely move the pointer away from the icon while dragging.)

  • Or: use something like <MyGrandchild onMouseDown={e => e.stopPropagation()}> on whatever parts of the child should not trigger reordering. (One can still use onClick on the very same parts.)

from react-reorder.

JakeSidSmith avatar JakeSidSmith commented on May 24, 2024

Closing due to lack of response. I assume the above workaround is suitable.

from react-reorder.

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.