material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Dialog]autoScrollBodyContent error without giving actions props

Open b4456609 opened this issue 11 years ago • 5 comments

I use "Dialog With Scrollable Content" code in http://material-ui.com/#/components/dialog If I don't give actions props, the chrome console display error message.

<Dialog  autoDetectWindowHeight={true} autoScrollBodyContent={true} ref="noteDialog" title={this.props.noteText}>
       <div style={{height: '2000px'}}>Really long content</div>
 </Dialog>
node_modules\material-ui\lib\dialog.js:348 Uncaught TypeError: Cannot read property 'offsetHeight' of null

b4456609 avatar Jul 16 '15 06:07 b4456609

I'm experiencing the same problem.

Seems to be easy to fix though: @ dialog.jsx:331

if (this.props.actions) should be if (this.props.actions.length)

antansk avatar Aug 05 '15 08:08 antansk

I can confirm this issue as well, and the proposed change seems to work fine. This bug (and the frequency of it) probably breaks all sites using scrollable bodies in dialogs. For instance on one of mine where I use a chain of promises, this bug triggers the catch handler more or less continously while entering data into a dialog (triggering re-rendering).

mariusk avatar Aug 19 '15 08:08 mariusk

I found a way to get over this problem: Use actions={0} in your Dialog props and the error is gone. But I have made a fork with a fix and a pull request for it.

antansk avatar Aug 19 '15 12:08 antansk

Thanks @corvuscornix

nikhildaga avatar Sep 06 '15 23:09 nikhildaga

The change made by @corvuscornix was merged in #1717

shaurya947 avatar Nov 18 '15 17:11 shaurya947