Skip to content
Discussion options

You must be logged in to vote

Thank you for your reply @SimoTod.

After some more digging, I understand now that the culprit is the default htmx swap/settle algorithm for elements with an id (documented here). There is also a corresponding htmx issue.

Possible workarounds include:

  • Remove the id attribute.
  • Set the htmx settle delay to zero (settle:0).
  • Use an alternative swap algorithm such as the alpine morph extension you mentioned. This also preserves the alpine state across swaps, which may or may not be what you want.
  • Remove the attributes in question from htmx.config.attributesToSettle.

I updated the Codepen, demonstrating 2 workarounds.

Replies: 6 comments 15 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@yaakovLowenstein
Comment options

@SimoTod
Comment options

SimoTod Jan 18, 2024
Collaborator

Comment options

You must be logged in to vote
2 replies
@yaakovLowenstein
Comment options

@ekwoka
Comment options

Comment options

You must be logged in to vote
2 replies
@yaakovLowenstein
Comment options

@ekwoka
Comment options

Comment options

You must be logged in to vote
7 replies
@ekwoka
Comment options

@yaakovLowenstein
Comment options

@yaakovLowenstein
Comment options

@SimoTod
Comment options

SimoTod Jan 19, 2024
Collaborator

@yaakovLowenstein
Comment options

Comment options

You must be logged in to vote
2 replies
@SimoTod
Comment options

SimoTod Mar 29, 2024
Collaborator

@shimikano
Comment options

Answer selected by yaakovLowenstein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants