`<select>` needs two clicks when used with remote functions form
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
When using a select within a remote functions form, clicking an option will not select the clicked option but the select will show empty instead. I need to click the same option again, only then is the option properly selected.
When I remove {...submitSelection} from the form element it works fine.
<script>
import { schema } from './dummy.common';
import { submitSelection } from './dummy.remote';
const options = [{ id: 1, name: `meditation` }, { id: 2, name: `yoga` }]
const selectedOption = $state(options[0]);
</script>
<form {...submitSelection} >
<select
{...submitSelection.fields.selection.as(`select`)}
value={selectedOption}
>
<option value={0}>Select an option</option>
{#each options as option (option.id)}
<option value={option.id}>{option.name}</option>
{/each}
</select>
<button type="submit" >Submit</button>
</form>
Reproduction
Logs
System Info
System:
OS: macOS 15.7.4
CPU: (12) arm64 Apple M2 Max
Memory: 109.91 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 26.0.0 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 11.12.1 - /opt/homebrew/bin/npm
pnpm: 11.1.1 - /opt/homebrew/bin/pnpm
bun: 1.3.12 - /Users/Samuel/.bun/bin/bun
Deno: 2.7.14 - /opt/homebrew/bin/deno
Browsers:
Brave Browser: 147.1.89.137
Chrome: 148.0.7778.167
Edge: 148.0.3967.54
Firefox: 149.0
Safari: 18.6
npmPackages:
@sveltejs/adapter-vercel: ^6.3.3 => 6.3.3
@sveltejs/enhanced-img: ^0.10.4 => 0.10.4
@sveltejs/kit: ^2.59.1 => 2.59.1
@sveltejs/vite-plugin-svelte: ^7.0.0 => 7.0.0
svelte: ^5.55.5 => 5.55.5
vite: ^8.0.8 => 8.0.8
Severity
serious, but I can work around it
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and inspect the remote form spread together with the select field binding. Reproduce the first-click failure, then trace the form and select interaction in the relevant SvelteKit code. Done means selecting an option works on the first click while the remote form binding remains present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100