Description
Bug report
Current behavior
When a state variable is passed to the value
prop of the Base UI Select
component, the Select
menu can still be opened, and a different option can be selected without using the onValueChange
function. This behavior is unexpected for a controlled component since changes to its value should only occur through the onValueChange
handler.
Expected behavior
The Select
component should function as a controlled component. Changes to the selected value should only be possible when handled via the onValueChange
function. The value
prop should strictly determine the displayed selected value.
Reproducible example
Steps to reproduce:
- Pass a state variable to the
value
prop of theSelect
component. (Already done) - Do not handle the
onValueChange
function. (Already commented out) - Open the
Select
menu and try selecting a different option. - Notice that the selected value changes without using
onValueChange
.
Base UI version
v1.0.0-alpha.5
Which browser are you using?
Chrome, Safari
Which OS are you using?
Mac OS
Additional context
This behavior contradicts the expected behavior of controlled components. It might cause inconsistencies in state management when using Select
in forms or other UI workflows.