When changing which option is selected in a select, the UI should correctly update.
When changing which option is selected in a select, the UI seems to reset the selection to the first one.
See reduced testcase here: https://gist.github.com/emanchado/9514b4219841fbfd03c1fed90b8ce99b. Shitty code, but easy to understand :-)
I'm guessing this is a bug in either choo or yo-yo, since morphdom seems to have a specific testcase for this: https://github.com/patrick-steele-idem/morphdom/tree/41d78acb982bb57949a92a1c377389a3d03b5018/test/fixtures/autotest/select-element.
hey @emanchado, i recently came across this bug as well. :bug:
it is most likely the same as https://github.com/maxogden/yo-yo/issues/37, where the suggested fix is to "both set a value on the <select> tag and set the selected attribute on the selected <option>", and the reason for the bug "to do with yo-yo copying the value of the existing select element to the new one (yo-yo/index.js#L29)".
hope this helps. :smile_cat:
Thanks a lot, that worked like a charm. Closing...
Most helpful comment
hey @emanchado, i recently came across this bug as well. :bug:
it is most likely the same as https://github.com/maxogden/yo-yo/issues/37, where the suggested fix is to "both set a value on the
<select>tag and set the selected attribute on the selected<option>", and the reason for the bug "to do with yo-yo copying the value of the existing select element to the new one (yo-yo/index.js#L29)".hope this helps. :smile_cat: