emilkowalski / vaul

An unstyled drawer component for React.
https://vaul.emilkowal.ski
MIT License
5.27k stars 170 forks source link

Text inside drawer component is not draggable for copying #295

Closed suhjohn closed 2 months ago

suhjohn commented 3 months ago

Hi, I expect the cursor to change when I hover on top of a p tag inside Drawer.Content. I want to be able to drag on the text so that I can copy it. This doesn't seem to work whether dismissible={false} or not. What can I do to fix this?

I played around on the console and I see that removing "vaul-drawer" on the top level fixes the issue. Is that necessary?

suhjohn commented 3 months ago

Solution I currently have

setTimeout(() => {
    const drawerElement = document.querySelector(
      'div[role="dialog"][vaul-drawer=""]',
    );
    if (drawerElement) {
      drawerElement.removeAttribute('vaul-drawer');
    }
  }, 500);

Makes the text draggable

emilkowalski commented 3 months ago

It's unclear what you what to achieve to me, can you clarify?

naufalfarras commented 3 months ago

we might want to copy and paste the text inside the drawer, instead when we want to drag to select the text, it is dragging the entire drawer (text was not selected)

gustavo-maurina commented 3 months ago

I also have this problem. I was hoping 0.9.0 would fix this, with the addition of [data-vaul-no-drag], but I'm not sure whether I'm using it the wrong way or not, but it doesn't seem to work for selecting text (I want to select text inside input that are on the drawer)

anstiwar commented 3 months ago

To copy text from the Drawer component we need to set the user-select to text instead of none. tried this using the browser developer mode and able to copy the text , but not sure how to apply this via my component code directly.

image