Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[Autocomplete] start adornment position issue with filled variant autocompletes #22544
Comments
|
Thanks for the repro @ImanMahmoudinasab Seems like the margin is coming from the
so we need to basically remove the margin. I would propose the following change: diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
index 88e164428..77c4d7c34 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
@@ -122,6 +122,9 @@ export const styles = (theme) => ({
padding: '4.5px 4px',
},
},
+ '& [class*="MuiInputAdornment-filled"][class*="MuiInputAdornment-positionStart"]:not([class*="MuiInputAdornment-hiddenLabel"])': {
+ marginTop: 0,
+ },
},
/* Styles applied to the input element. */
input: {This is the end result: What do you think about this? Would you like to work on a PR for this? :) |
|
@mnajdova +1 The structural difference is that the OutlinedInput has the We have the same issue with: <TextField
InputProps={{
startAdornment: <InputAdornment position="start">Which?</InputAdornment>
}}
multiline
label="Combo box"
variant="filled"
/>https://codesandbox.io/s/material-demo-forked-1bdng?file=/demo.js This has the same root cause than what we have with #21409 (Autocomplete) and #22241 (multiline TextField). |
|
Maybe in the future, we should look into how we can unify the CSS for multiline and Autocomplete use cases. |


Current Behavior😯
start adornment's position is not correct when autocomplete has a filled variant. it has an extra margin on top:

Expected Behavior🤔
Steps to Reproduce🕹
Demo: codesandbox
Your Environment🌎