New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sortable example fixes #1868
Sortable example fixes #1868
Conversation
Is this one ready for review? |
yes it is @alexpetros |
Can you add some inline comments in the code explaining what you explain here in the description? It's a good (and I think necessary) fix, but it does take away somewhat from the simplicity of the example so it would help to offset that with a little explanation. |
@alexpetros Sure! How does it look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it, thanks for the update!
* add missing quotation mark * make `.htmx-indicator` unsortable * change cursors to indicate grabbable items * bug fix: bug: when an item is dragged fast enough before the previous request was completed, dropping after request completion resulted in the addition of an extra item to the list. fix: disable sortable on End event, and re-enable it on htmx:afterSwap. * add a few inline comments + better naming
Main changes:
Fix bug where, when an item is dragged fast enough before a previous request is completed, dropping it after the request's completion resulted in the addition of an extra item to the list. This is fixed by disabling the sortable on its
end
event, and re-enabling it on itshtmx:afterSwap
event.Before:
before.mp4
After:
after.mp4
Disable draggability of the
.htmx-indicator
("Updating...") element.Before:
before.mp4
After:
after.mp4
Other changes:
.htmx-indicator
todefault
rather thantext
, since it's not supposed to be selectable especially while hidden.