I’m having trouble selecting a given option in a drop down selection.
An ellie app outlining my problem is running here:
https://ellie-app.com/46PqBT8q73ja1
Specifically, I have one select that I fill with strings from different lists:
select []
<| List.map (\item -> option [ Attributes.selected (initial == item) ] [ text item ] ) model.data
I would assume that the selected
attribute sets which item is selected, but that doesn’t seem to ring true all the time. initial
here is the head of the model.data
list, so my expectation is that this code would focus on the first item in the list.
If you run the ellie though, and select large from the dropdown (i.e. the last item in the list), then click the Weather button to update the select’s contents, you’ll see rain is the selected option.
How can I set the focus to the first option in the list (in this case sun)?