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][Autocomplete] Shouldn't resize when hovering (@ZeeshanTamboli) #42535

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions packages/mui-material/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ const AutocompleteRoot = styled('div', {
];
},
})({
[`&.${autocompleteClasses.focused} .${autocompleteClasses.clearIndicator}`]: {
visibility: 'visible',
},
/* Avoid double tap issue on iOS */
'@media (pointer: fine)': {
[`&:hover .${autocompleteClasses.clearIndicator}`]: {
visibility: 'visible',
},
},
[`& .${autocompleteClasses.tag}`]: {
margin: 3,
maxWidth: 'calc(100% - 6px)',
Expand All @@ -103,23 +112,6 @@ const AutocompleteRoot = styled('div', {
minWidth: 30,
},
},
[`&.${autocompleteClasses.focused}`]: {
[`& .${autocompleteClasses.clearIndicator}`]: {
visibility: 'visible',
},
[`& .${autocompleteClasses.input}`]: {
minWidth: 0,
},
},
/* Avoid double tap issue on iOS */
'@media (pointer: fine)': {
[`&:hover .${autocompleteClasses.clearIndicator}`]: {
visibility: 'visible',
},
[`&:hover .${autocompleteClasses.input}`]: {
minWidth: 0,
},
},
[`& .${inputClasses.root}`]: {
paddingBottom: 1,
'& .MuiInput-input': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,27 @@ export default function SmallAutocompleteWithStartAdornment() {
<TextField
{...params}
label="Autocomplete"
InputProps={{
...params.InputProps,
startAdornment: (
<SvgIcon>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M4.5 12a7.5 7.5 0 0015 0m-15 0a7.5 7.5 0 1115 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077l1.41-.513m14.095-5.13l1.41-.513M5.106 17.785l1.15-.964m11.49-9.642l1.149-.964M7.501 19.795l.75-1.3m7.5-12.99l.75-1.3m-6.063 16.658l.26-1.477m2.605-14.772l.26-1.477m0 17.726l-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205L12 12m6.894 5.785l-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864l-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"
/>
</svg>
</SvgIcon>
),
slotProps={{
input: {
...params.InputProps,
startAdornment: (
<SvgIcon>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M4.5 12a7.5 7.5 0 0015 0m-15 0a7.5 7.5 0 1115 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077l1.41-.513m14.095-5.13l1.41-.513M5.106 17.785l1.15-.964m11.49-9.642l1.149-.964M7.501 19.795l.75-1.3m7.5-12.99l.75-1.3m-6.063 16.658l.26-1.477m2.605-14.772l.26-1.477m0 17.726l-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205L12 12m6.894 5.785l-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864l-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"
/>
</svg>
</SvgIcon>
),
},
}}
/>
)}
Expand Down
Loading