Skip to content

Commit

Permalink
fixed modal close issue (apache#5865)
Browse files Browse the repository at this point in the history
* fixed modal close issue

* change Children array to Fragment

(cherry picked from commit 10836ce)
  • Loading branch information
conglei authored and mistercrunch committed Sep 21, 2018
1 parent 53b6fda commit 48b2c4c
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions superset/assets/src/components/ModalTrigger.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Modal, MenuItem } from 'react-bootstrap';
import cx from 'classnames';
Expand Down Expand Up @@ -83,29 +83,35 @@ export default class ModalTrigger extends React.Component {
});
if (this.props.isButton) {
return (
<Button
className="modal-trigger"
tooltip={this.props.tooltip}
onClick={this.open}
>
{this.props.triggerNode}
<Fragment>
<Button
className="modal-trigger"
tooltip={this.props.tooltip}
onClick={this.open}
>
{this.props.triggerNode}
</Button>
{this.renderModal()}
</Button>
</Fragment>
);
} else if (this.props.isMenuItem) {
return (
<MenuItem onClick={this.open}>
{this.props.triggerNode}
<Fragment>
<MenuItem onClick={this.open}>
{this.props.triggerNode}
</MenuItem>
{this.renderModal()}
</MenuItem>
</Fragment>
);
}
/* eslint-disable jsx-a11y/interactive-supports-focus */
return (
<span className={classNames} onClick={this.open} role="button">
{this.props.triggerNode}
<Fragment>
<span className={classNames} onClick={this.open} role="button">
{this.props.triggerNode}
</span>
{this.renderModal()}
</span>
</Fragment>
);
}
}
Expand Down

0 comments on commit 48b2c4c

Please sign in to comment.