Repository navigation
Focus lost when using AlpineJS $id after the Livewire request is sent #2826
Unanswered
johanvanhelden
asked this question in
7. Bugs (archived)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi all! Not sure if this is a bug, or me not understanding something.
I was watching Caleb's Laracon talk and he was showing of how to use Alpine to generate ids for elements.
So I just finished implementing it, but after I type some data into an input element, and the Livewire request is sent to the server, the input looses its focus.
Demo:

The HTML for the input element looks like this:
If I revert the
$id()changes, everything works like it should, without anything loosing focus.Unfortunately the ID stays the same after the async request. Before the reload it is
input-2and after losing the focus it remainsinput-2. So that one does not change. I can actually not see any changes in the source. No part of the input group's HTML seems to change.Also posted in the Livewire discussions section, but it's a bit dead in there. So maybe it's more Alpine's fault?
livewire/livewire#4790
All reactions