One-com / knockout-dragdrop

A drag and drop binding for Knockout.
BSD 3-Clause "New" or "Revised" License
85 stars 29 forks source link

Input elements default prevented when inside the dragZone #22

Open daveraanan opened 9 years ago

daveraanan commented 9 years ago

Hi guys,

you lib is great, easy and convenient. when i set a dragZone on a container you are preventing default on all elements, can you PREVENT the prevent default on elements like button and input's. ex: i have a numeric input but the input is not been updated! it will be nice to have a way to set a dragZone with CSS classes to be ignored on mouse down event, it will easily add support for css buttons (div's buttons).

Thanks

sunesimonsen commented 9 years ago

Hi, I think I know what you mean, but could you possible provide a working example that highlights the problem. If you just fork the project and add another example I'll figure out if it is possible to support your use case. knockout-dragdrop does a lot of bad stuff to work nicely across browsers, so your use case might conflict with the main functionality. But there will probably be some way around the issue.

daveraanan commented 9 years ago

Hi, here is a demo on jsfiddle https://jsfiddle.net/rnwzagnk/2/, but this issue with the input is NOT happening, meaning it is working fine. I checked my code and it is exactly the same. for my code to work i need to add a workaround in your script on line 456, i check the the mouse event only if the target element is not 'input' i prevent default: if (downEvent.target && downEvent.target.localName !== 'input') { downEvent.preventDefault(); } do you think of more tests i can do to understand why the jsfiddle demo is working and me code do not?....on jsfiddle i encountred a different issue, when you drag a row item out of the table it creates another item. on me code it do not with or without the workaround Thanks

sunesimonsen commented 9 years ago

Hey thanks for the fiddle, that is really helpful. I'll look into the problem soon. Now I have a clear understanding of what it is you are trying to achieve.