Skip to content

Remote form's automatic reset should clear touched state, etc. #15103

@hyunbinseo

Description

@hyunbinseo

Describe the bug

SvelteKit's "automatic form reset after remote form submission" should do a full reset including touched states.

Existing issues request APIs to do this:

But I really hope this becomes the SvelteKit's default:

Currently, using oninput or onchange for validation shows incorrect messages in consecutive form submissions.

Reproduction

For some reason, I can only reproduce this in Firefox. All password manager extensions were disabled.

2025-12-28.212538.mp4

https://github.com/hyunbinseo/svelte-kit-15103

  1. Focus the email input
  2. Enter a valid value and press Enter to submit
  3. The form is automatically reset (reference)
  4. Click outside the input to trigger onchange
  5. The following validation error is shown:

Invalid email: Received ""

<script lang="ts">
  import { PublicSchema } from './form';
  import { submitEmail } from './form.remote';
</script>

<form
  {...submitEmail.preflight(PublicSchema)}
  onchange={() => submitEmail.validate({ preflightOnly: true })}
>
  <label>
    <span>Email</span>
    <input {...submitEmail.fields.email.as('email')} />
  </label>
  <ul>
    {#each submitEmail.fields.email.issues() as issue}
      <li>{issue.message}</li>
    {/each}
  </ul>
  <button>Submit</button>
</form>

Logs

System Info

System:
  OS: Windows 11 10.0.26200
  CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
  Memory: 6.82 GB / 31.48 GB
Binaries:
  Node: 24.12.0 - C:\Users\hyunb\AppData\Local\fnm_multishells\32780_1766922545167\node.EXE
  Yarn: 1.22.22 - C:\Users\hyunb\AppData\Local\fnm_multishells\32780_1766922545167\yarn.CMD
  npm: 11.6.2 - C:\Users\hyunb\AppData\Local\fnm_multishells\32780_1766922545167\npm.CMD
  pnpm: 10.26.2 - C:\Users\hyunb\AppData\Local\fnm_multishells\32780_1766922545167\pnpm.CMD
  Deno: 2.4.0 - C:\Users\hyunb\.deno\bin\deno.EXE
Browsers:
  Chrome: 143.0.7499.170
  Edge: Chromium (140.0.3485.54)
  Firefox: 146.0.1 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
  @sveltejs/adapter-auto: ^7.0.0 => 7.0.0
  @sveltejs/kit: ^2.49.2 => 2.49.2
  @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
  svelte: ^5.46.0 => 5.46.1
  vite: ^7.3.0 => 7.3.0

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions