Skip to content

Conversation

ritujachopade
Copy link

Description

Fixes #3198

This PR updates the hidden input inside the Select component to handle cases
where no option is selected.

Changes

  • Changed value={value} to value={value ?? ""} in the hidden input
  • Ensures that when no value is selected, the form submits an empty string ("")
    instead of undefined or defaulting to the first option

Before

When a <Select> was rendered with no value selected, the hidden input could
default to the first option’s value, causing forms to submit an unintended result.

After

If no value is selected, the hidden input now submits an empty string (""),
allowing form submissions to correctly reflect that no selection was made.

Copy link

changeset-bot bot commented Oct 2, 2025

🦋 Changeset detected

Latest commit: cc5d6ce

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

This PR includes changesets to release 2 packages
Name Type
@radix-ui/react-select Major
radix-ui 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

@ritujachopade
Copy link
Author

@chaance @benoitgrelard Can one of you please review?

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.

Controlled empty select element submits first value by default
1 participant