Jump to content

Recommended Posts

Posted

Hey guys,

I am currently working on GUI for my server.
I am using ReactJS and for drag and drop i am using SortableJS.
The issue i have is that drag and drop does not seem to work even though it works in the browser.
I tried to debug events and it seems that onDragStart doesn't run on clicking div container.
While writing this i wanted to be sure that it isn't something that i did in react so i created almost blank html page with one div in it:

Spoiler

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div 
        onclick="document.getElementById('root').innerHTML = 'Clicked'"
        ondragstart="document.getElementById('root').innerHTML = 'Draggable start'"
        ondragend="document.getElementById('root').innerHTML = 'Draggable end'"
        draggable="true" 
        style="width: 10rem; height: 10rem; background-color: antiquewhite;" 
        id="root">
        Draggable
    </div>
</body>
</html>

 

After it loads it only fires onclick event, dragging is ignored (It works in chrome). I don't really know what to do...
Do i have to insert some flag somewhere or do something to enable drag and drop? Or do i have to do some hacky ways to get drag and drop?

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...