tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

Dialog position is off the screen #370

Closed pablocubico closed 8 years ago

pablocubico commented 8 years ago

I can't see the Dialog opened by using the component, I think the offending line is:

https://github.com/tleunen/react-mdl/blob/master/src/Dialog/Dialog.js#L30

Which takes body.clientHeight into account.

For a dialog over a fixed overlay, I would use the window height instead of the body, to ensure that the dialog is placed within the limits of the viewport.

The Dialog is getting these styles:

captura de pantalla 2016-08-16 a las 15 51 03

Which are obviously based on the calculations made using body.clientHeight:

captura de pantalla 2016-08-16 a las 15 51 29

I can make a pull request to fix that line if you need me to.

tleunen commented 8 years ago

Hmm indeed, it seems the window.innerHeight is more appropriate. Thanks for the report! And yes, a PR is always welcome :)