You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In a LiveView app, I'm trying to use live_select as a more user-friendly substitute to HTML select controls, with all options preloaded.
So, I have replaced select with live_select on a form_component.ex live component, sitting on top of a foreign key field. When creating a new entity, live_select works as expected, letting the user type ahead and select one of the options. While still in the :newlive_action of the form (not having saved the entity yet), clicking back into the live_select field clears the option. Clicking out of the field brings the option back, as per design decisions.
Once the entity is saved, and the user chooses to edit it subsequently—the :editlive_action of the form—the correct option is displayed in the live_select control, with the correct id value in the hidden input field, with the help of the component's value_mapper option.
However, when the field receives focus now—whether through a mouse click or through keyboard tabbing into the field—the value is again lost, but not subsequently reinstated on the blur event. Inspection of the hidden input field also shows it to be empty now. This happens even when the value_mapper option is unused, and the field is left to display the raw id of the referenced entity.
This appears to be buggy behaviour.
Expected behaviour
I would imagine that the value would be replaced back into the field, as is the case when creating a new entity.
Actual behaviour
When the field receives focus, it clears the value of both input fields, and leaves their value empty, even after the blur event takes place.
LiveSelect and LiveView versions
LiveView version: 1.0.0-rc.1
LiveSelect version: 1.4.2
Describe the bug
In a LiveView app, I'm trying to use
live_select
as a more user-friendly substitute to HTMLselect
controls, with all options preloaded.So, I have replaced
select
withlive_select
on aform_component.ex
live component, sitting on top of a foreign key field. When creating a new entity,live_select
works as expected, letting the user type ahead and select one of the options. While still in the:new
live_action
of the form (not having saved the entity yet), clicking back into thelive_select
field clears the option. Clicking out of the field brings the option back, as per design decisions.Once the entity is saved, and the user chooses to edit it subsequently—the
:edit
live_action
of the form—the correct option is displayed in thelive_select
control, with the correctid
value in the hiddeninput
field, with the help of the component'svalue_mapper
option.However, when the field receives focus now—whether through a mouse click or through keyboard tabbing into the field—the value is again lost, but not subsequently reinstated on the
blur
event. Inspection of the hiddeninput
field also shows it to be empty now. This happens even when thevalue_mapper
option is unused, and the field is left to display the rawid
of the referenced entity.This appears to be buggy behaviour.
Expected behaviour
I would imagine that the value would be replaced back into the field, as is the case when creating a new entity.
Actual behaviour
When the field receives focus, it clears the value of both
input
fields, and leaves theirvalue
empty, even after theblur
event takes place.Screenshots

Browsers
Firefox stable and nightly, Safari, Arc
Issue Repo
A minimal demonstration repo reproducing the problem
The text was updated successfully, but these errors were encountered: