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

fix(checkbox): bind indeterminate for Svelte 5 compatibility #2044

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Nov 10, 2024

Fixes #2039

In Svelte 5, <input indeterminate={indeterminate} /> does not update the value. Binding the variable seems to work.

Tested the following with Svelte 4 and Svelte 5. The difference now is that indeterminate is reactive (two-way).

<script>
  import { Checkbox } from "carbon-components-svelte";

  let indeterminate = true;
</script>

<Checkbox labelText="Label text" bind:indeterminate />

<p>Indeterminate: {indeterminate}</p>

<button on:click={() => (indeterminate = !indeterminate)}>Toggle indeterminate</button>

indeterminate.mov

@metonym metonym force-pushed the indeterminate-checkbox-svelte5 branch from ef34770 to 6d0886e Compare November 10, 2024 18:58
@metonym metonym merged commit 9d5e7e3 into master Nov 10, 2024
3 checks passed
@metonym metonym deleted the indeterminate-checkbox-svelte5 branch November 10, 2024 19:50
@metonym
Copy link
Collaborator Author

metonym commented Nov 20, 2024

Released in v0.86.0

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

Successfully merging this pull request may close these issues.

[Svelte 5] Checkbox indeterminate state not updating
1 participant