Skip to content

Conversation

Rich-Harris
Copy link
Member

Until recently there were restrictions on what content could appear inside <select> and <option> elements. That's no longer true, and so we should probably drop the compiler errors that prevent people from building customizable selects.

Closes #15617

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link

changeset-bot bot commented Oct 6, 2025

🦋 Changeset detected

Latest commit: fdb66fe

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

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Playground

pnpm add https://pkg.pr.new/svelte@16903

@paoloricciuti
Copy link
Member

This is not possible right now...only the parser in chrome will persist element within the select, the same code will work in chrome and fail hydration on safari and Firefox. We need to add runtime logic to branch based on CSS.support and build both hydration marching

Copy link
Member

@paoloricciuti paoloricciuti left a comment

Choose a reason for hiding this comment

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

Requesting change to prevent accidental merge

@7nik
Copy link
Contributor

7nik commented Oct 6, 2025

As I have written in the issue, it is much deeper. Also, there is a simple workaround of using components/snippets to mask the "non-allowed" content.

@paoloricciuti
Copy link
Member

The workaround still fucks up hydration tho

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.

A <select> can now include rich HTML content

3 participants