Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Drag and Drop: Drop in non-valid dropzones

I’m working on a drag and drop web application using Vue.JS and Vuex Store. The functionality is implemented pretty much following the mdn docs for “HTML Drag and Drop API”. So my Dropzone Component and Draggable Element Components work with event.preventDefault(). As I have nested Dropzones, I also use event.stopPropagation() on the Dropzones. Drag and drop with the designated compoents works fine.

Nested dropzones illustration

My problem is: When a user drops a Draggable Element outside of a Dropzone, the UI kind of breaks. So what I’m looking for is a app-wide event Listener for drops in non-valid dropzone areas.

I tried it with a global “dragend” listener, but that doesn’t seem to work. I also tried “mouseup”, but that seems to general. Here’s what I tried:

new Vue({
    router,
    store,
    render: (h) => h(App),
    async created() {
        window.document.addEventListener('dragend', (e) => {
            console.log("global Dragend -------------- ");
        })

        window.document.addEventListener('mouseup', (e) => {
            console.log("global Mouseup -------------- ");
        })
    },
}).$mount('#app');

I'm hoping that somebody knows how to implement an app-wide EventListener that triggers after failed drops.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could add a 'no-drop' class to the elements that you don't want to be drop zones. And then when drop event received you can prevent drop

How to prevent drop into a div element?

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!