Skip to content

Commit 93aeb17

Browse files
feat: add prop to disable auto closing dialog (#1416)
Co-authored-by: Daria Domagała <[email protected]>
1 parent 14c9aee commit 93aeb17

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Dialog/Dialog.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class Dialog extends Component {
7070
titleProps,
7171
title,
7272
allowListForLockFocus,
73+
disableAutoClose,
7374
...rest
7475
} = this.props;
7576

@@ -148,7 +149,7 @@ class Dialog extends Component {
148149
<div className={classnames(`${cssNamespace}-bar__right`)}>
149150
{React.Children.toArray(actions).map((child, index) => (
150151
<div className={classnames(`${cssNamespace}-bar__element`)} key={index}>
151-
{React.cloneElement(child, { className: classnames(`${cssNamespace}-dialog__decisive-button`), onClick: chain(this.handleCloseClick, child.props?.onClick) })}
152+
{React.cloneElement(child, { className: classnames(`${cssNamespace}-dialog__decisive-button`), onClick: disableAutoClose ? child.props?.onClick : chain(this.handleCloseClick, child.props?.onClick) })}
152153
</div>
153154
))}
154155
</div>
@@ -180,6 +181,8 @@ Dialog.propTypes = {
180181
className: PropTypes.string,
181182
/** Additional props to be spread to the content section of the dialog */
182183
contentProps: PropTypes.object,
184+
/** Additional props to disable auto closing dialog */
185+
disableAutoClose: PropTypes.bool,
183186
/** Additional props to be spread to the footer of the dialog */
184187
footerProps: PropTypes.object,
185188
/** Text or Custom React node for the components header */

0 commit comments

Comments
 (0)