Skip to content

The text in the form input wrapped in react-draggable cannot be selected normally #653

Open

Description

@jwangyangls

As an example
When I use the antd modal component (any component can be reproduced), I use the drag and drop function. At this time, if I add an input (or textarea) to the modal and write text in the input, then I write the text in the most input text. Hold down the left mouse button on the right and swipe left to select text (quickly), when the mouse slides outside of react-draggable, the background color of the selected text in the input disappears, and the input becomes the state of triggering the focus.

How can I avoid this abnormal situation?

The following three pictures represent snapshots taken during mouse movement
1.
image
2.
image
3.
image

Activity

  1. Abban-Fahim commented on Apr 25, 2022

    @Abban-Fahim

    Have you added the input element into the list of attributes to not trigger dragging (the cancel attribute on the Draggable Component)?

    Could you provide the source code for me to help you further?

  2. jwangyangls commented on Apr 26, 2022

    @jwangyangls
    Author

    @Abban-Fahim I made a demo; https://stackblitz.com/edit/react-ts-uwoi15?file=Hello.tsx
    steps:

    1. Please drag the header text to the right to move the drag area to the right by about 200px
    2. Enter text in input
    3. Use the mouse/trackpad to select text from right to left until the mouse reaches an area outside the drag area
      At this point, you can see that the selected text has lost its selected state
  3. jwangyangls commented on Apr 26, 2022

    @jwangyangls
    Author

    image

  4. jwangyangls commented on Apr 27, 2022

    @jwangyangls
    Author

    Please take the time to look at this question.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions