diff --git a/docs/src/pages/components/autocomplete/ComboBox.js b/docs/src/pages/components/autocomplete/ComboBox.js index 24ab3f73ec45ef..e1737ba03e4c70 100644 --- a/docs/src/pages/components/autocomplete/ComboBox.js +++ b/docs/src/pages/components/autocomplete/ComboBox.js @@ -6,11 +6,12 @@ import Autocomplete from '@material-ui/core/Autocomplete'; export default function ComboBox() { return ( ( - + )} /> ); diff --git a/docs/src/pages/components/autocomplete/ComboBox.tsx b/docs/src/pages/components/autocomplete/ComboBox.tsx index 24ab3f73ec45ef..e1737ba03e4c70 100644 --- a/docs/src/pages/components/autocomplete/ComboBox.tsx +++ b/docs/src/pages/components/autocomplete/ComboBox.tsx @@ -6,11 +6,12 @@ import Autocomplete from '@material-ui/core/Autocomplete'; export default function ComboBox() { return ( ( - + )} /> ); diff --git a/packages/material-ui/src/Autocomplete/Autocomplete.js b/packages/material-ui/src/Autocomplete/Autocomplete.js index de3ec2bf0b1456..3363fc1b49b12d 100644 --- a/packages/material-ui/src/Autocomplete/Autocomplete.js +++ b/packages/material-ui/src/Autocomplete/Autocomplete.js @@ -254,12 +254,6 @@ export const styles = (theme) => ({ }, }); -function DisablePortal(props) { - // eslint-disable-next-line react/prop-types - const { anchorEl, open, ...other } = props; - return
; -} - const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { /* eslint-disable @typescript-eslint/no-unused-vars */ const { @@ -314,7 +308,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { openText = 'Open', options, PaperComponent = Paper, - PopperComponent: PopperComponentProp = Popper, + PopperComponent = Popper, popupIcon = , renderGroup: renderGroupProp, renderInput, @@ -327,8 +321,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { } = props; /* eslint-enable @typescript-eslint/no-unused-vars */ - const PopperComponent = disablePortal ? DisablePortal : PopperComponentProp; - const { getRootProps, getInputProps, @@ -481,6 +473,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) { className={clsx(classes.popper, { [classes.popperDisablePortal]: disablePortal, })} + disablePortal={disablePortal} style={{ width: anchorEl ? anchorEl.clientWidth : null, }}