yourlabs / django-autocomplete-light

A fresh approach to autocomplete implementations, specially for Django. Status: v4 alpha, v3 stable, v2 & v1 deprecated.
https://django-autocomplete-light.readthedocs.io
MIT License
1.79k stars 467 forks source link

Fix django-nested-admin dragging fields #1309

Closed trumpet2012 closed 1 year ago

trumpet2012 commented 1 year ago

Fixing an issue where dragging an inline admin section would initialize the autocomplete fields during the dragging phase and when dragging stopped the autocomplete field would be reset and not get initialized again since the internal initialized list would already contain that element.

To prevent this, added a check to the DOM listener logic to verify that the container element being added isn't the one used to represent the element while it is being dragged.

Before

https://user-images.githubusercontent.com/6753326/191374994-cdae0bb1-d244-447b-9417-2a062821e443.mov

After

https://user-images.githubusercontent.com/6753326/191375318-99a9cb2a-46e6-4fa3-a77e-b30f0ba68411.mov