Nested Dialogs don't display correctly
See original GitHub issueDescription
If you have a Dialog component with a DatePicker field inside, then when you open the DatePicker, it is displayed behind the Dialog.
If you look at the DOM, you’ll see, that when Dialog is opened, new Span element is added as a first child of Body. When DatePicker dialog is opened, then the new Span element, which contains picker’s UI is again added as a first child of Body. If I reorder these Span elements in Chrome DevTools, then DatePicker is displayed correctly.
Images/Screenshots

Link to a gist or code sample where the issue can be reproduced
App class:
import React, { PureComponent } from 'react';
import Dialog from 'react-md/lib/Dialogs';
import Button from 'react-md/lib/Buttons/Button';
import DatePicker from 'react-md/lib/Pickers/DatePickerContainer';
export default class App extends PureComponent {
constructor(props) {
super(props);
this.state = { visible: false };
}
openDialog = () => {
this.setState({ visible: true });
};
closeDialog = () => {
this.setState({ visible: false });
};
render() {
const { visible } = this.state;
return (
<div>
<Button raised onClick={this.openDialog} label="Open Modal Dialog" />
<Dialog
id="speedBoost"
visible={visible}
title="Use Google's location service?"
onHide={this.closeDialog}
aria-labelledby="speedBoostDescription"
modal
actions={[
{
onClick: this.closeDialog,
primary: true,
label: 'OK',
}]}
>
<DatePicker/>
</Dialog>
</div>
);
}
}
Version
- React 15.4.2,
- React-MD 1.0.1
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top Results From Across the Web
What are the accessibility issues with nested modal dialogs
There is no accessibility with nested modal dialogs per se. The problem is more often caused by the fact that the UI frameworks,...
Read more >Some web application modal dialog boxes don't work correctly ...
Fixes an issue that triggers unexpected behavior when you interact with web application modal dialog boxes in Internet Explorer 11.
Read more >Solved: Re: Script UI dialogs not displaying correctly on
ScriptUI has inner default values that we can use when creating our panels. Try this: var dlg = new Window('dialog', 'Test'); dlg.margins =...
Read more >Dialog window positioning is not preserved in AutoCAD ...
AutoCAD product: Dialog box and palette positions are not preserved between sessions, or after closing the dialog box.
Read more >Nested dialogs
Nesting dialogs is a questionable design pattern that is not referenced anywhere in the HTML 5.2 Dialog specification.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With the latest fix, you will no longer have to do any work yourself. If any component that uses the Portal component appears within the children of the
Dialog
, it will automatically render as a child in the dialog instead of rendering in thedocument.body
by default.The date picker, time picker, snackbar, drawer, and dialog should now be rendered inside of the full page dialog.
Yeah, this should be fixed in the library. I’ll think about how I want to fix it. It is really a problem with using the Portal component for dialogs – I should either update the Pickers to pass the
renderNode
andlastChild
props correctly to the dialog, or update the z-index for.md-dialog.md-dialog--picker
to be higher, or update the Portal component to optionally NOT render as a subtree (eventual feature that should be added).