mirror of
https://github.com/maputnik/editor.git
synced 2026-01-06 21:40:01 +00:00
Delay modal close until blur events have triggered.
This commit is contained in:
@@ -19,6 +19,17 @@ class Modal extends React.Component {
|
|||||||
underlayClickExits: true
|
underlayClickExits: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See <https://github.com/maputnik/editor/issues/416>
|
||||||
|
onClose = () => {
|
||||||
|
if (document.activeElement) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
}
|
||||||
|
|
||||||
|
setImmediate(() => {
|
||||||
|
this.props.onOpenToggle(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getApplicationNode() {
|
getApplicationNode() {
|
||||||
return document.getElementById('app');
|
return document.getElementById('app');
|
||||||
}
|
}
|
||||||
@@ -32,7 +43,7 @@ class Modal extends React.Component {
|
|||||||
getApplicationNode={this.getApplicationNode}
|
getApplicationNode={this.getApplicationNode}
|
||||||
data-wd-key={this.props["data-wd-key"]}
|
data-wd-key={this.props["data-wd-key"]}
|
||||||
verticallyCenter={true}
|
verticallyCenter={true}
|
||||||
onExit={() => this.props.onOpenToggle(false)}
|
onExit={this.onClose}
|
||||||
>
|
>
|
||||||
<div className="maputnik-modal"
|
<div className="maputnik-modal"
|
||||||
data-wd-key={this.props["data-wd-key"]}
|
data-wd-key={this.props["data-wd-key"]}
|
||||||
@@ -41,7 +52,7 @@ class Modal extends React.Component {
|
|||||||
<h1 className="maputnik-modal-header-title">{this.props.title}</h1>
|
<h1 className="maputnik-modal-header-title">{this.props.title}</h1>
|
||||||
<span className="maputnik-modal-header-space"></span>
|
<span className="maputnik-modal-header-space"></span>
|
||||||
<button className="maputnik-modal-header-toggle"
|
<button className="maputnik-modal-header-toggle"
|
||||||
onClick={() => this.props.onOpenToggle(false)}
|
onClick={this.onClose}
|
||||||
data-wd-key={this.props["data-wd-key"]+".close-modal"}
|
data-wd-key={this.props["data-wd-key"]+".close-modal"}
|
||||||
>
|
>
|
||||||
<MdClose />
|
<MdClose />
|
||||||
|
|||||||
Reference in New Issue
Block a user