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

[Dialog] overflow property cause issue with react-select control #7431

Closed
futbolistua opened this issue Jul 14, 2017 · 13 comments
Closed

[Dialog] overflow property cause issue with react-select control #7431

futbolistua opened this issue Jul 14, 2017 · 13 comments
Labels
component: dialog This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@futbolistua
Copy link

futbolistua commented Jul 14, 2017

Versions

Material-UI: 1.0.0-alpha.19
React: 15.5.4
Browser: Chrome

In current implementation of Dialog component dialog content has next style MuiDialogContent-root-... and predefined style property overflow-y:auto

capture1

it cause issue when I use Select component from react-select

capture3
capture2

But without this property all work fine
capture4

Is it possible to fix it?

@oliviertassinari oliviertassinari added v1 component: dialog This is the name of the generic UI component, not the React module! labels Jul 14, 2017
@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 14, 2017

The overflow is here so we get a scrollbar when the content is too large. I think that it should be the default behavior. Regarding addressing that issue, here are some possible solutions that I would use:

  • Overrides the style of DialogContent to disable that scrolling handling
  • Do not use DialogContent and use something home made instead
  • Hope that react-select portal the suggestion list at some point (as we do on the master branch)

@oliviertassinari oliviertassinari added the support: question Community support but can be turned into an improvement label Jul 14, 2017
@futbolistua
Copy link
Author

How about Menu? In my opinion it will have the same behavior. Does it mean that I cannot use any component that have modal portal inside DialogContent ?

@oliviertassinari
Copy link
Member

The Menu is using the portal feature. No issue on that end.

@pietrofxq
Copy link

I have a similar issue, but with the Paper inside the Dialog. It has this style applied:

overflowY: 'auto', // Fix IE11 issue, to remove at some point.

I was able to workaround by passing a className to PaperProps and duplicating the original styles and applying a overflow:visible to the new class. But it'd be nice if we could control the overflow with a prop too.

@MichalCzerwonka
Copy link

MichalCzerwonka commented Jun 28, 2018

The same here, this solve a problem:
const styles = theme => ({ dialogPaper: { overflow: 'visible' } });

<Dialog PaperProps={{ className: classes.dialogPaper }}>

@nthgol
Copy link

nthgol commented Aug 21, 2018

just adding to @michaell94 what worked for me. I had both a Dialog and DialogContent, so the following worked:

const styles = theme => ({ root: { overflow: 'visible' } });

<Dialog classes={{ paperScrollPaper: classes.root }}>

<DialogContent className={classes.root}>

image

image

@PhilipeGatis
Copy link

https://react-select.com/advanced#portaling

@sanjanaHE
Copy link

not a good solution for dialogs with long forms

@MarekJavurek
Copy link

MarekJavurek commented Jun 1, 2019

Thanks! Just adding to @nthgol . (I am on version 4.0.1) This worked for me but I had to remove <SwipeableViews ... > !

EDIT: also be sure to remove scroll={"body"} from Dialog component!

@ibsenvalath
Copy link

ibsenvalath commented Feb 16, 2020

just adding to @michaell94 what worked for me. I had both a Dialog and DialogContent, so the following worked:

const styles = theme => ({ root: { overflow: 'visible' } });

<Dialog classes={{ paperScrollPaper: classes.root }}>

<DialogContent className={classes.root}>

image

image

That works! Thanks

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 2, 2020

Note that a better alternative to react-select is available at https://mui.com/material-ui/react-autocomplete/.

@dnquang1996vn
Copy link

You want to look at the menuPortalTarget prop. There's a topic on this in the Advanced documentation, specifically with a modal example provided. Something like:
<Select {...otherProps} menuPortalTarget={document.body} />
Then set index for menu portal

@woorykim
Copy link

woorykim commented Jul 7, 2022

const StyleDialog = styled(Dialog)(({ theme }) => ({
  "& .MuiPaper-root": {
    overflowY: "visible",
  },
}));

<StyleDialog open={open} onClose={handleClose}>
  <DialogContent>
    <Autocomplete      
      disablePortal
      renderInput={(params) => <TextField {...params} label={label} />}
    />
  </DialogContent>
</StyleDialog>

just adding to @ibsenvalath what worked for me. Dialog components and style features enabled the following to work:
Thanks! I just added it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests