Skip to content

defaultChecked does not work in form remote functions #14707

@hyunbinseo

Description

@hyunbinseo

Describe the bug

<script lang="ts">
  import { FormSchema } from './ids';
  import { addId } from './ids.remote';
</script>

<form {...addId.preflight(FormSchema)}>
  <fieldset>
    {#each ['windows', 'mac', 'linux'] as os, index}
      <label>
        <!-- windows is not checked -->
        <input {...addId.fields.operatingSystem.as('radio', os)} defaultChecked={!index} />
        {os}
      </label>
    {/each}
  </fieldset>
  <fieldset>
    {#each ['windows', 'mac', 'linux'] as os, index}
      <label>
        <!-- windows is checked -->
        <input type="radio" name="os" value={os} defaultChecked={!index} />
        {os}
      </label>
    {/each}
  </fieldset>
</form>

Happens on both Firefox and Chrome.

Image
<form method="POST" action="?/remote=14dkmo%2FaddId">
  <fieldset>
    <!-- dev tools shows that it is checked, but the UI does not reflect this -->
    <label><input name="operatingSystem" type="radio" value="windows" checked="" /> windows</label
    ><label><input name="operatingSystem" type="radio" value="mac" /> mac</label
    ><label><input name="operatingSystem" type="radio" value="linux" /> linux</label>
  </fieldset>
  <fieldset>
    <label><input type="radio" name="os" value="windows" checked="" /> windows</label
    ><label><input type="radio" name="os" value="mac" /> mac</label
    ><label><input type="radio" name="os" value="linux" /> linux</label>
  </fieldset>
</form>

Reproduction

https://github.com/hyunbinseo/svelte-kit-template/tree/mre-kit-14707

Logs

System Info

System:
  OS: Windows 11 10.0.26100
  CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
  Memory: 3.51 GB / 31.48 GB
Binaries:
  Node: 24.10.0 - C:\Users\hyunb\AppData\Local\fnm_multishells\24580_1760341048510\node.EXE
  Yarn: 1.22.22 - C:\Users\hyunb\AppData\Local\fnm_multishells\24580_1760341048510\yarn.CMD
  npm: 11.6.1 - C:\Users\hyunb\AppData\Local\fnm_multishells\24580_1760341048510\npm.CMD
  pnpm: 10.18.2 - C:\Users\hyunb\AppData\Local\fnm_multishells\24580_1760341048510\pnpm.CMD
  Deno: 2.4.0 - C:\Users\hyunb\.deno\bin\deno.EXE
Browsers:
  Chrome: 141.0.7390.76
  Edge: Chromium (140.0.3485.54)
  Firefox: 143.0.4 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
  @sveltejs/adapter-auto: ^6.1.1 => 6.1.1 
  @sveltejs/kit: ^2.46.5 => 2.46.5 
  @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
  svelte: ^5.39.11 => 5.39.11 
  vite: ^7.1.7 => 7.1.7

Severity

blocking an upgrade

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