Skip to content
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

Problems with select boxes (dropdowns) #277

Closed
emanchado opened this issue Oct 12, 2016 · 2 comments
Closed

Problems with select boxes (dropdowns) #277

emanchado opened this issue Oct 12, 2016 · 2 comments

Comments

@emanchado
Copy link

Expected behavior

When changing which option is selected in a select, the UI should correctly update.

Actual behavior

When changing which option is selected in a select, the UI seems to reset the selection to the first one.

Steps to reproduce behavior

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.

@ahdinosaur
Copy link
Collaborator

ahdinosaur commented Oct 12, 2016

hey @emanchado, i recently came across this bug as well. 🐛

it is most likely the same as max-mapper/yo-yo#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. 😸

@emanchado
Copy link
Author

Thanks a lot, that worked like a charm. Closing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants