Skip to content

fix: Fixes error thrown on use of select with no options#18449

Open
kaushikashok45 wants to merge 4 commits into
sveltejs:mainfrom
kaushikashok45:select_sibling_issue_fix
Open

fix: Fixes error thrown on use of select with no options#18449
kaushikashok45 wants to merge 4 commits into
sveltejs:mainfrom
kaushikashok45:select_sibling_issue_fix

Conversation

@kaushikashok45

Copy link
Copy Markdown

What problem does this solve?

Fixes #18445.

Any sibling element or text node placed after a <select> with a value attribute caused the Svelte compiler to crash with:

Cannot read properties of null (reading 'type')

The error originates inside esrap during code generation, because the compiler was emitting a malformed AST node (e.object was null) for the value attribute on <select>.

Minimal repro:

<select value="foo">
</select>
foo

Root cause

The guard that short-circuits attribute handling for two-way bindable properties (value, checked) only covered input and textarea — it did not include select. As a result, when a <select value="..."> appeared with a sibling, the compiler fell through to a code path that produced a broken AST.

Fix

Expanded the node name check to also include 'select':

This ensures <select value="..."> is handled consistently with <input value="..."> and <textarea value="...">.

@changeset-bot

changeset-bot Bot commented Jun 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 861adde

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kaushikashok45

kaushikashok45 commented Jun 21, 2026

Copy link
Copy Markdown
Author

Hi, this PR resolves #18445 and passes all local testing. Ready for your review when you have a moment! @Rich-Harris

@dummdidumm dummdidumm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Comment thread .changeset/every-rabbits-rule.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any sibiling after a <select> crashes the compiler

2 participants