Next.js Discord

Discord Forum

Can anyone explain why onDrop is not working?

Answered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Australian Freshwater CrocodileOP
onDrop doesn't work when I drop images from my pc on it. The behaviour is just normal (opens the image on another tab in chrome)
onDragEnter and onDragLeave works.

    function handleOnDrop(e: DragEvent<HTMLDivElement>) {
        e.preventDefault();
        e.stopPropagation();
        console.log("testing")
    }

    return (
        <div onDragEnter={handleOnDragEnter} onDragLeave={handleOnDragLeave} onDrop={handleOnDrop} onClick={handleDropZoneClick} className='drop-zone'>
        </div>
    )
Answered by Australian Freshwater Crocodile
Solved: onDragOver prop is required for onDrop. I replaced onDragEnter with onDragOver
View full answer

1 Reply

Australian Freshwater CrocodileOP
Solved: onDragOver prop is required for onDrop. I replaced onDragEnter with onDragOver
Answer