From 218ce148d5a4a03f448cb3389b8bb3384efa5107 Mon Sep 17 00:00:00 2001 From: orangemug Date: Fri, 19 Oct 2018 08:39:07 +0100 Subject: [PATCH] Delay modal close until blur events have triggered. --- src/components/modals/Modal.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/modals/Modal.jsx b/src/components/modals/Modal.jsx index b3518ae..7fc1393 100644 --- a/src/components/modals/Modal.jsx +++ b/src/components/modals/Modal.jsx @@ -19,6 +19,17 @@ class Modal extends React.Component { underlayClickExits: true } + // See + onClose = () => { + if (document.activeElement) { + document.activeElement.blur(); + } + + setImmediate(() => { + this.props.onOpenToggle(false); + }); + } + getApplicationNode() { return document.getElementById('app'); } @@ -32,7 +43,7 @@ class Modal extends React.Component { getApplicationNode={this.getApplicationNode} data-wd-key={this.props["data-wd-key"]} verticallyCenter={true} - onExit={() => this.props.onOpenToggle(false)} + onExit={this.onClose} >
{this.props.title}