bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
22.01k stars 1.97k forks source link

Bug with loss of focus input inside container directive #527

Closed ghost closed 4 years ago

ghost commented 7 years ago

If we place the input inside dragula directive -we have bug with loss of focus from input when we click on container of dragula directive.

test It seems a problem in this part of the code test2

If I click on input then the focus is not removed from an input when clicking on a green square(hence the event blue does not work)

https://plnkr.co/edit/aY5CXoh7nCrGE3YIWAb7?p=preview

Is it possible to fix this something?

amk221 commented 4 years ago

@Ts-alan In the above code (in your screenshot), the preventDefault that is causing the issue, is only reached if dragula considers the click is for a draggable element.

Therefore, it's possible to work around the issue by telling dragula to ignore the element you want to focus:

{
  invalid: function(el) {
    return el.classList.contains('ignore-me');
  }
}

...but I agree, it's still classed as an issue.