Unverified Commit d5343dfb authored by Benjamin Wheeler's avatar Benjamin Wheeler Committed by GitHub

fix ReactModal bodyOpenClassName error so that it is entirely omitted, rather...

fix ReactModal bodyOpenClassName error so that it is entirely omitted, rather than passing null value (#2176)
parent 1f8342b9
......@@ -23,14 +23,15 @@ class Modal extends React.Component {
return this.modal.portal.requestClose();
}
render () {
// bodyOpenClassName prop cannot be blank string or null here; both cause
// an error, because ReactModal does not correctly handle them.
// If we're not setting it to a class name, we must omit the prop entirely.
const bodyOpenClassNameProp = this.props.useStandardSizes ?
{bodyOpenClassName: classNames('overflow-hidden')} : {};
return (
<ReactModal
appElement={document.getElementById('app')}
// bodyOpenClassName can be blank string, but must not be null here; a null value causes
// an error, because ReactModal does not correctly handle the case of a null bodyOpenClassName
bodyOpenClassName={classNames({
'overflow-hidden': this.props.useStandardSizes
})}
{...bodyOpenClassNameProp}
className={{
base: classNames('modal-content', this.props.className, {
'modal-sizes': this.props.useStandardSizes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment