Skip to content

[BUG]: drag axis doesn't work properly #969

Open

Description

@mohiwalla

What is happening?

I'm able to drag element in the non-allowed direction after mouseup event.
Dragging is only allowed for X axis in this example on story book, it works but only until mouse key is not lifted up.
Check this video.

Screencast_20250301_081510.webm

How to reproduce?

  1. Go to this page.
  2. Try dragging the element in non-allowed direction.
  3. Lift mouse key up after dragging.
  4. It should get dragged to other axis as well.

What should be happening?

As per the docs, it should only be draggable in one direction.

Image

System details
OS: Arch Linux, KDE plasma
Browser: Chrome, Firefox
Code sample: https://github.com/bokuweb/react-rnd/blob/master/stories/dragAxis/dragAxisX.tsx

Activity

  1. mohiwalla commented on Mar 1, 2025

    @mohiwalla
    Author

    Tried this example locally, working even weird.

    import { Rnd } from "react-rnd"
    
    export default function Page() {
      return (
        <Rnd
          style={{ border: "thin solid black" }}
          default={{ x: 0, y: 0, width: 200, height: 200 }}
          dragAxis="x"
        >
          001
        </Rnd>
      )
    }

    Instead of being dragged immediately to non-allowed axis, it shows on original posistion until you start resizing.

    Screencast_20250301_084227.webm
  2. ofkarakus commented on Apr 8, 2025

    @ofkarakus

    I have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions