Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

239
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda