Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][Select] Select has an unexisting "placeholder" props #43571

Open
PierreTurnbull opened this issue Sep 2, 2024 · 0 comments
Open
Assignees
Labels
component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material typescript

Comments

@PierreTurnbull
Copy link

PierreTurnbull commented Sep 2, 2024

Steps to reproduce

Link to live example: (required)
Unfortunately the sandbox tells me the dependencies are missing somehow, although I followed the documentation guide on how to build a reproduction case. As a consequence, the bug is not reproduced. Here is the link in case it might help:
https://codesandbox.io/s/lingering-frog-n75572?file=/src/Demo.tsx:10-11

Current behavior

The Select component's type has a placeholder prop, however this property does not exist in the Select implementation. I have checked the documentation of v4, v5, v6 and could only find examples of implementing a placeholder by hand. I have not found any placeholder prop. On top of that, adding a placeholder prop to the Select doesn't do anything.

If my understanding is correct, the problem comes from the BaseSelectProps interface, which extends a portion of InputProps. InputProps has a placeholder property. This property is not omitted in the InputProps extension of BaseSelectProps, which as a consequence means the Select has a placeholder property:

From Select/Select.d.ts, line 13:

export interface BaseSelectProps<Value = unknown>
  extends StandardProps<InputProps, 'value' | 'onChange'> {

Expected behavior

The Select component must not have a placeholder prop.

I suppose this is the right solution:

export interface BaseSelectProps<Value = unknown>
  extends StandardProps<InputProps, 'value' | 'onChange' | 'placeholder'> {

Context

No response

Your environment

System: OS: macOS 13.4 Binaries: Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node npm: 10.2.5 - ~/.nvm/versions/node/v20.9.0/bin/npm pnpm: 8.10.3 - /opt/homebrew/bin/pnpm Browsers: Chrome: 128.0.6613.86 Edge: Not Found Safari: 16.5 npmPackages: @emotion/react: ^11.11.1 => 11.11.1 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.4 @mui/core-downloads-tracker: 6.0.1 @mui/icons-material: 5.15.11 => 5.15.11 @mui/lab: 5.0.0-alpha.134 => 5.0.0-alpha.134 @mui/material: 6.0.1 => 6.0.1 @mui/private-theming: 5.15.0 @mui/styled-engine: 5.15.0 @mui/styles: ^5.11.13 => 5.15.0 @mui/system: 5.15.0 @mui/types: 7.2.11 @mui/utils: 5.15.0 @mui/x-date-pickers: ^5.0.20 => 5.0.20 @types/react: ^18.0.28 => 18.2.45 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.5.2 => 5.5.2
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: select, placeholder

@PierreTurnbull PierreTurnbull added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 2, 2024
@zannager zannager added the component: select This is the name of the generic UI component, not the React module! label Sep 2, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title Select has an unexisting "placeholder" props [material-ui][Select] Select has an unexisting "placeholder" props Sep 5, 2024
@ZeeshanTamboli ZeeshanTamboli added the package: material-ui Specific to @mui/material label Sep 5, 2024
@siriwatknp siriwatknp added typescript enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material typescript
Projects
None yet
Development

No branches or pull requests

5 participants