Can't use `Element.remove()` nor `Element.replaceChildren()` in LiveView modal

This is not fix for your problem but why do you have phx-remove there? It’s only called when element is removed from DOM. Wouldn’t that call fade-out etc in hide_modal for non existing element when modal element is removed from DOM? Because JS.hide will likely be called on client when element is already removed.

Is it possible you have missed basic HTML issue meaning ids need to be unique for the whole DOM tree. Looking at your code for example you have one element named as close and that’s quite generic. With duplicate ids you can have all sorts of odd behaviors.

As I side note I run into some oddities that you can’t have input element ‘name’ attribute to be id for example because by some odd browser logic there names will be shown as JavaScript field on the element by that name.