#drag event not working?

5 messages · Page 1 of 1 (latest)

willow shell
#

Im facing a weird issue, which i have no idea why its happening.


    <body>
        <script src="/src/index.tsx" type="module"></script>

        <div>
            <h1 class="title">Hello World!</h1>
            <p id="currentTime"></p>

            <div id="draggableBox" draggable="true">Drag me</div>
        </div>

-- // this one is working ??
        <script>
            const draggableBox = document.getElementById("draggableBox");

            draggableBox.addEventListener("dragstart", function (e) {
                console.log("Drag started");
            });
        </script>
    </body>

// not working ??
const Home = () => {
    const MinimalDraggable = () => {
        const handleDragStart = (e: DragEvent) => {
            console.log("Drag started");
        };

        return (
            <div
                draggable
                onDragEnter={handleDragStart}
                onDragStart={handleDragStart}
            >
                Drag me
            </div>
        );
    };

    return (
        <div>
            <MinimalDraggable />
        </div>
    );
};

Here the issue, the MinimalDraggable is not working, even tho its identical to manual script demo.
What is going on here??

pearl prairie
#

try

 <div
    draggable="true"`
willow shell
#

it worked, still weird, a standalone prop by itself shoud mean true

pearl prairie
willow shell
#

ah, thanks, at least there is a source explaning what is going on