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

Calling a dialog element inside a dialog element disable the scroll #2779

Closed
dalizwei opened this issue Jan 4, 2016 · 7 comments
Closed
Labels
bug 🐛 Something doesn't work

Comments

@dalizwei
Copy link

dalizwei commented Jan 4, 2016

Hello,
I tried for some days to figure out a solution for this problem without success.
I'm calling a dialog element like DatePicker inside an other dialog element 'x'.
When i close 'x' the scroll of the main page(the page containing the first dialog 'x') get disabled.
Thanks for helping.

@oliviertassinari
Copy link
Member

That seems an issue with the ordre in which componentWillUnmont is called https://github.com/callemall/material-ui/blob/master/src/overlay.jsx#L50.

@dalizwei
Copy link
Author

dalizwei commented Jan 4, 2016

So the componentWillUnmont of DatePicker is called after Dialog 'x' applying the _originalBodyOverflow of Dialog 'x' to the main page?
If it's the problem, is there a way to fix it?

@oliviertassinari
Copy link
Member

So the componentWillUnmont of DatePicker is called after Dialog 'x' applying the _originalBodyOverflow of Dialog 'x' to the main page?

This is what I though, but no, according to:

componentDidMount of a parent gets called after componentDidMount of its children, so you know your children are fully initialized before using them.
facebook/react#4752 (comment)

This bug doesn't make sense to me.

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Jan 4, 2016
@dalizwei
Copy link
Author

dalizwei commented Jan 5, 2016

Searching deeply, i saw that componentWillUnmont in the overlay.jsx was the problem.
removing it like this dalizwei@4864eb6 solved the problem and i kept the good behavior of the page.
Something else i found is that allowing and preventing the scroll is also done by _applyAutoLockScrolling when the props show get updated so what is the purpose of componentWillUnmont here ?

@oliviertassinari
Copy link
Member

what is the purpose of componentWillUnmont here ?

That's to make sure the body.style.overflow will have the correct value event if the <Dialog /> is unmonted while opened.

@dalizwei
Copy link
Author

dalizwei commented Jan 6, 2016

So it would be better to test if the Dialog is open before running _allowScrolling() like this dalizwei@4864eb6.
Still fix the problem for me, but i don't know if it's the best way to deal with it.

@elca2712
Copy link
Contributor

elca2712 commented Jan 6, 2016

Hi, I have the same problem with dialog in dialogs, I do the fix like this https://github.com/elca2712/material-ui/commit/616b528a1fecf8f7e86e63964d435be4b227485c

This way it prevent to set an overflow:hidden on already empty overflow when _allowScrolling is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests

3 participants