8000 Calling `useDragAndDrop` anywhere breaks default text selection behavior of browser for the whole page. · Issue #142 · formkit/drag-and-drop · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Calling useDragAndDrop anywhere breaks default text selection behavior of browser for the whole page. #142
Closed
@Girildo

Description

@Girildo

After the first time useDragAndDrop is called anywhere on the page, the default behavior of clicking on text is altered.
In particular, clicking on some selected text should deselect the text, but this is not the case if using this library.
This is true for Chromium based browsers but not on Firefox.
Here a reproduction link (using Vue as I am, but I don't think it matters much): https://codesandbox.io/p/devbox/headless-glade-wp6d83
I tested with both versions 0.4.2 and 0.3.4 of the library.

I am almost certain this is due to the call to preventDefault in handleRootPointerup

function handleRootPointerup(e: PointerEvent) {
  pd(e); // <--- this line
  if (state.pointerDown) state.pointerDown.node.el.draggable = true;
  state.pointerDown = undefined;
  if (!isSynthDragState(state)) return;
  const config = state.currentParent.data.config;
  if (isSynthDragState(state)) config.handleEnd(state);
}

but I'm not sure how to fix this problem without breaking other features.

Currently, I am running a patched version of the package that just ignores the whole rootPointerup handler.

Thank you for the great library and the work you put into it!

Let me know if you need any other info!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0