-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix: ensure select value is updated upon select element removal #10846
Conversation
🦋 Changeset detectedLatest commit: 691ebf9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
"svelte": patch | ||
--- | ||
|
||
fix: ensure select value is updated upon select element removal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select option removal?
var selected_option = select.querySelector(':checked'); | ||
if (selected_option === null || get_option_value(selected_option) !== value) { | ||
update(''); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not take <select multiple ...>
into account. If three options are selected and one is removed, the remaining two should still be selected (Example).
observer.observe(select, { | ||
childList: true | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need subtree: true
because of <optgroup>
(Example).
Fixes #9517