[Select] Controlled components Allows Value Change Without onValueChange Handler #1331
Labels
component: select
This is the name of the generic UI component, not the React module!
status: waiting for maintainer
These issues haven't been looked at yet by a maintainer
Bug report
Current behavior
When a state variable is passed to the
value
prop of the Base UISelect
component, theSelect
menu can still be opened, and a different option can be selected without using theonValueChange
function. This behavior is unexpected for a controlled component since changes to its value should only occur through theonValueChange
handler.Expected behavior
The
Select
component should function as a controlled component. Changes to the selected value should only be possible when handled via theonValueChange
function. Thevalue
prop should strictly determine the displayed selected value.Reproducible example
Link to a CodeSandbox
Steps to reproduce:
value
prop of theSelect
component. (Already done)onValueChange
function. (Already commented out)Select
menu and try selecting a different option.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.The text was updated successfully, but these errors were encountered: