idiomorph icon indicating copy to clipboard operation
idiomorph copied to clipboard

Focused element deleted by morph

Open pdf opened this issue 1 year ago • 0 comments

I'm using htmx and am looking for more granular DOM updates. After installing the htmx extension from this project and enabling it via hx-swap="morph" on the relevant element, the morph occurs however the currently focused element is completely deleted from the DOM.

This happens regularly when a child input element value change triggers a swap of the parent, since the input will always be focused during the swap.

If I specify hx-swap="morph:{ignoreActive:true}" this behaviour is avoided, but that seems like a hack, and (IIUC) will ignore changes to the active element that sent by the server, which is undesirable in this case.

pdf avatar May 12 '24 23:05 pdf