Skip to content

Bug: Select when passed a value as Prop errors with a suggestion to pass readOnly  #27657

Closed
@Biki-das

Description

@Biki-das

Seems weird when we try to use a select component, and pass a value as a prop, it prompts with the error to either set onChange or readOnly.
the readOnly at the last seems misleading since the select component does not have a readOnly prop, unlike inputs which do have a readOnly attribute.

SELECT PROPS
https://react.dev/reference/react-dom/components/select

seems an easy fix would be to check if the mounted component is a select component and then conditionally just change the error message, though would need to add tests to support the same.

Screen.Recording.2023-11-06.at.9.27.49.AM.mov

cc @sophiebits

codesandbox link to tinker:- https://codesandbox.io/s/admiring-wright-9sctsn?file=/src/App.js

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions