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

[TextField] Autocomplete does not allow the select to open when text field uses input slotProps (any of them) #45086

Open
chaim0m opened this issue Jan 22, 2025 · 2 comments
Assignees
Labels
component: text field 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 support: question Community support but can be turned into an improvement

Comments

@chaim0m
Copy link

chaim0m commented Jan 22, 2025

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/react-eomwegjs?file=Demo.tsx
  2. Click on Autocomplete, select will not open.

Current behavior

Clicking on Autocomplete when input is provided to TextField component does not open the list.

Expected behavior

When clicking on the TextField the list should open (in this case the movies example)

Context

I need to have an auto complete with a custom text field containing end adornments.

Your environment

Forked on stackblitz from MUI autocomplete example.

Search keywords: TextField, slotProps, AutoComplete

@chaim0m chaim0m added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 22, 2025
@zannager zannager added the component: text field This is the name of the generic UI component, not the React module! label Jan 23, 2025
@DiegoAndai
Copy link
Member

Hey @chaim0m, thanks for the report!

There's a typo in your example:

<Autocomplete
      disablePortal
      options={top100Films}
      sx={{ width: 300 }}
      renderInput={(params) => (
        <TextField
          {...params}
          slotProps={{
            input: {
-              ...params.inputProps,
+              ...params.InputProps,
              endAdornment: (
                <>
                  {'$'}
                  {params.InputProps?.endAdornment}
                </>
              ),
            },
          }}
          label="Movie"
        />
      )}
    />

Let me know if this fixes the issue.

@DiegoAndai DiegoAndai added support: question Community support but can be turned into an improvement status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 23, 2025
@chaim0m
Copy link
Author

chaim0m commented Jan 23, 2025

Hey @chaim0m, thanks for the report!

There's a typo in your example:

<Autocomplete
disablePortal
options={top100Films}
sx={{ width: 300 }}
renderInput={(params) => (
<TextField
{...params}
slotProps={{
input: {

  •          ...params.inputProps,
    
  •          ...params.InputProps,
            endAdornment: (
              <>
                {'$'}
                {params.InputProps?.endAdornment}
              </>
            ),
          },
        }}
        label="Movie"
      />
    )}
    
    />
    Let me know if this fixes the issue.

Thank you for pointing this out unfortunately this does not solve the issue.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field 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 support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants