[Autocomplete] Composing `endAdornment` overlaps collapse/expand icon
See original GitHub issueSee https://github.com/mui-org/material-ui/issues/28465#issuecomment-927613778 for general problem description.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
endAdornment
overlaps with the loading indicator.
Example code:
renderInput={(params) => {
return (
<TextField
// eslint-disable-next-line react/jsx-props-no-spreading
{...params}
label={'Select service providers'}
InputProps={{
...params.InputProps,
endAdornment: (
<React.Fragment>
<CircularProgress color={'inherit'} size={20} />
{params.InputProps.endAdornment}
</React.Fragment>
),
}}
/>
)
}}
Expected Behavior 🤔
Loading indicator should be positioned next to the endAdornment as it was in v4
Steps to Reproduce 🕹
Frozen CodeSandbox: https://codesandbox.io/s/autocomplete-composed-endadornment-vemqi
Steps:
- Migrate from v4 to v5 using safe codemod
- Setup async Autocomplete component as described here: https://mui.com/components/autocomplete/#asynchronous-requests
Context 🔦
Not really sure what to write here… Well, the code above worked perfectly in v4 but now it seems to be broken for me…
Your Environment 🌎
`npx @mui/envinfo`
System:
OS: Linux 5.11 Linux Mint 20.2 (Uma)
Binaries:
Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.5/bin/yarn
npm: 7.20.6 - ~/.nvm/versions/node/v14.17.5/bin/npm
Browsers:
Chrome: 93.0.4577.82
npmPackages:
@emotion/react: ^11.4.1 => 11.4.1
@emotion/styled: ^11.3.0 => 11.3.0
@mui/core: 5.0.0-alpha.47
@mui/icons-material: ^5.0.0 => 5.0.0
@mui/lab: ^5.0.0-alpha.47 => 5.0.0-alpha.47
@mui/material: ^5.0.0 => 5.0.0
@mui/private-theming: 5.0.0
@mui/styled-engine: 5.0.0
@mui/styled-engine-sc: ^5.0.0 => 5.0.0
@mui/styles: ^5.0.0 => 5.0.0
@mui/system: 5.0.0
@mui/types: 7.0.0
@mui/utils: 5.0.0
@types/react: ^17.0.21 => 17.0.21
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
styled-components: ^5.3.1 => 5.3.1
typescript: ^4.4.2 => 4.4.3
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:15 (5 by maintainers)
Top Results From Across the Web
[Autocomplete] Composing `endAdornment` overlaps ...
Using Autocomplete component with size='small' overlaps endAdornment & expand icon. As I understand, it is because Autocomplete use an InputBase ...
Read more >Material UI - Autocomplete Styling
I am trying to style the padding so that the icon is pushed to the far right side in an AutoComplete Material ...
Read more >Breaking changes in v5, part two: core components
This is a reference guide to all of the breaking changes introduced in Material v5, and how to handle them when migrating from...
Read more >material-ui/core/CHANGELOG.md
- ⚛️ A first step toward converting all the demos to React Hooks (#13873) @adeelibr. 124, - And many more bug fixes and...
Read more >CHANGELOG.md
`@material-ui/core@v3.4.0` - [Autocomplete] Fix react-select input overflow ... [icons] Resize svg icons (#12356) @the-question - [Collapse] Add all class ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please consider re-opening this @eps1lon. We are having the same issue with the following code:
digging a bit and comparing with the example in the docs, it appears this is only an issue when using
size="small"
(removing this prop results in the loader being positioned correctly) becausesize="small"
is removing thepadding-right
required to align the spinner properly (or any otherendAdornment
for that matter)with
size="small"
without
I ran into the same issue. Using Autocomplete component with
size='small'
overlaps endAdornment & expand icon.As I understand, it is because Autocomplete use an
InputBase
component with a padding set to 6px ifsize='small'
:In my opinion, the proper way to deal with that, is to override your Autocomplete styles via your theme configuration. Something like :
Each Autocomplete with
size='small'
will now be rendered with a 39px padding preventing overlaps.Hope this helps you.