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

checkbox bind:group doesn't play nice with duplicated values #4397

Closed
Conduitry opened this issue Feb 9, 2020 · 1 comment · Fixed by #4877
Closed

checkbox bind:group doesn't play nice with duplicated values #4397

Conduitry opened this issue Feb 9, 2020 · 1 comment · Fixed by #4877
Labels
awaiting submitter needs a reproduction, or clarification bug

Comments

@Conduitry
Copy link
Member

Describe the bug
Using <input type='checkbox' bind:group={foo} value='...'> where multiple checkboxes have the same value produces wonky behavior.

Logs
None.

To Reproduce

<script>
	let foo = [];
</script>

Checked: {foo}

<hr>

<input type='checkbox' bind:group={foo} value='a'>a<br>
<input type='checkbox' bind:group={foo} value='b'>b<br>
<input type='checkbox' bind:group={foo} value='c'>c<br>
<input type='checkbox' bind:group={foo} value='d'>d<br>

<hr>

<input type='checkbox' bind:group={foo} value='a'>a<br>
<input type='checkbox' bind:group={foo} value='b'>b<br>
<input type='checkbox' bind:group={foo} value='c'>c<br>
<input type='checkbox' bind:group={foo} value='d'>d<br>

Expected behavior
It would be nice if checking/unchecking one 'a' would result in just one instance of the value being added to the array, and would also cause the other one to be checked/unchecked in sync.

Stacktraces
None.

Information about your Svelte project:
v3.18.2

Severity
Low-ish, probably.

Additional context
Came up while investigating #3680, and I consider this part to be a separate issue, unrelated to the {...spread} attributes.

@Conduitry
Copy link
Member Author

Fixed in 3.23.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification bug
Projects
None yet
1 participant