Skip to content

onChange event doesn't run when the checkbox change to disabled #15256

@olahdavee

Description

@olahdavee

Describe the bug

I have a next example code:

<script>
	let checked = $state(false);
</script>

<input
  type="checkbox"
  bind:checked
  disabled={checked}
  onchange={() => {
    console.log('onChange')
  }}
/>

{checked}

When I check the checkbox, it becomes disabled, but the on change event doesn't run. If I delete the disabled={checked} line, the code will be works.

Reproduction

https://svelte.dev/playground/c854976cf1c04935aa6da9e2b621d044?version=5.19.9

System Info

System:
  OS: Windows 11 10.0.26100
  CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Memory: 7.26 GB / 15.87 GB
Binaries:
  Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
  npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Chromium (130.0.2849.80)
  Internet Explorer: 11.0.26100.1882

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions