-
Notifications
You must be signed in to change notification settings - Fork 47
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
Selections are immediately cleared/reset with Liveview 1.0 #72
Comments
Hi and thanks for flagging this! I will have a look as soon as I find some time |
Hi @markolson-powerschool, I just pushed c85673c to fix this specific problem on main, can you please check if it works for you?
Confused because live view has been focusing my Screen.Recording.2024-06-16.at.23.52.12.movPretty annoying. Why do you say that LV pre 1.0 wasn't focusing |
Even stranger: I do get the Screen.Recording.2024-06-17.at.06.38.18.movIf you have any idea of what might be going on here, that'd would be very helpful :) This doesn't make much sense and smells like a LV bug to me |
This does seems to work! We'll give it a more thorough once-over this morning.
phoenixframework/phoenix_live_view@c46af7d |
|
Huh, well then. I'm wondering what I recreated using that commit then, and wishing I'd taken better contemporaneous notes. |
No you were right and I made a mistake: it's phoenixframework/phoenix_live_view@c46af7d that introduced the bug. (I had checked out the commit but forgotten to rebuild the live_view assets locally, they're not updated with every new commit to the js code!) Ok, cool, so now we narrowed it down to that commit. I'm gonna try to fix the remaining problem (the input not getting focus) |
Fixed with b31a9f8 |
Upgrading our application to LV 1.0.0-rc.0, we're now seeing every LiveSelect with a value reset to its previous selection once the input has a blur event triggered.
There was a bug pre 1.0 where liveview wouldn't focus
readonly
inputs, meaning that blur events wouldn't fire afterwards, and we suspect that's what's triggering this behavior. Watching whichHANDLE EVENT
log messages come in, we do see that there is no"blur"
event triggered with lv 0.20.14, but there is with 1.0.0-rc.0.Changing the dep to
{:phoenix_live_view, "==1.0.0-rc.0", override: true},
and updating the assets, you see this behavior on the sample app:LV1.0.0-rc.0.mov
We can't think of a situation where blurring should reset the field, but wanted to see if there was some subtlety we were missing before making a PR that...
maybe_restore_selection
inhandle_event("blur", ...)
clear
inhandle_event("focus", ...)
, usingparent_event
consistently.Doing those two things gets the dropdown behaving as we'd expect, as best we can tell...
Removing clear doesn't let you search again, of course..
lv-1.0.0-rc.0-with-patch.mov
The text was updated successfully, but these errors were encountered: