Skip to content
Bug reportOct 21, 2026· 0:20· 11 views

Svelte 5 (5.57.2): bound values reset when a Reset-button click is cancelled with preventDefault()

0:20 total

Comments · 0

Be the first to comment.

Bug reportby SceneRecap AI

mediumSvelte 5 runtime form reset handling for bind:checked and bind:value. The internal reset listener that restores bound values appears not to check event.defaultPrevented.
file: App.sveltemode: RUNEStool: Svelte Playground (svelte.dev)svelte_version: 5.57.2 (from the user title, not visible in the recording)playground_title: Cancelled form reset still resets bindings

Repro steps

  1. 1.Open a Svelte Playground with a form that has onreset={(e) => e.preventDefault()}. Inside it, add a checkbox with bind:checked, an input with bind:value={text} and a button with type="reset". The initial state is checked = $state(false) and text = $state('').
  2. 2.In the Result pane, tick the checkbox and type 'h' into the text input.
  3. 3.Continue typing so the input contains 'hi'. The output reads checked: true, text: "hi".
  4. 4.Click the Reset button. The click is not captured in the event log. It happens between 9.0s and 11.0s.
  5. 5.Observe the checkbox, the input and the output line.

Expected

The reset is cancelled by e.preventDefault(), so nothing changes. The checkbox stays ticked, the input keeps 'hi' and the output stays checked: true, text: "hi". The Result pane says this at 1.0s.

Actual

After the Reset click, the checkbox is unticked and the input is empty. The output reads checked: false, text: "" at 11.0s. These values stay cleared through the end of the recording at 19.0s.

Evidence

visualThe editor shows <form onreset={(e) => e.preventDefault()}> with a bind:checked checkbox, a bind:value={text} input and a type="reset" button. The Result pane says the reset is cancelled, so nothing should change.
visualThe checkbox is ticked and the input contains 'h'. The output reads checked: true, text: "h". The bindings update correctly while typing.
visualThe input contains 'hi' and the output reads checked: true, text: "hi".
visualThe state is unchanged just before the reset: checked: true, text: "hi".
visualThe checkbox is unticked and the input is empty. The output reads checked: false, text: "" even though onreset calls e.preventDefault().
visualThe Reset button appears slightly highlighted while the values remain cleared.
visualThe values are still cleared at the end of the recording: checked: false, text: "".
Issue markdown (copy-paste ready)
## Bug: bound values reset when a form reset is cancelled with preventDefault()

**Environment**
- Svelte Playground (svelte.dev), RUNES mode
- Svelte 5.57.2 (from the report title)

**Repro**
```svelte
<script>
  let checked = $state(false);
  let text = $state('');
</script>

<form onreset={(e) => e.preventDefault()}>
  <input type="checkbox" bind:checked />
  <input bind:value={text} />
  <button type="reset">Reset</button>
</form>

<p>checked: {checked}, text: {JSON.stringify(text)}</p>
```

1. Tick the checkbox (5.0s).
2. Type `hi` into the input. The output shows `checked: true, text: "hi"` (7.0s, 9.0s).
3. Click **Reset**. This happens between 9.0s and 11.0s and was not captured in the event log.

**Expected**
The reset is cancelled, so nothing changes. The output stays `checked: true, text: "hi"`.

**Actual**
At 11.0s the checkbox is unticked and the input is empty. The output reads `checked: false, text: ""`. It stays this way through 19.0s.

**Evidence**
- 1.0s: the code shows `onreset={(e) => e.preventDefault()}`. The Result pane states that nothing should change.
- 5.0s and 7.0s: the bindings update correctly while editing.
- 11.0s: the values are reset despite preventDefault().
- No console output was visible. The console pane is collapsed.

**Suggested area**
The runtime reset listener for `bind:checked` and `bind:value` likely does not respect `event.defaultPrevented`.

*Recorded with SceneRecap.*

Your recordings could explain themselves too.

Free plan · silent recordings welcome · bug reports included.

Try SceneRecap free →
Svelte 5 (5.57.2): bound values reset when a Reset-button click is cancelled with preventDefault() · SceneRecap