mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:51:16 +01:00
Delay modal close until blur events have triggered.
This commit is contained in:
parent
906d7ac3d5
commit
218ce148d5
1 changed files with 13 additions and 2 deletions
|
@ -19,6 +19,17 @@ class Modal extends React.Component {
|
|||
underlayClickExits: true
|
||||
}
|
||||
|
||||
// See <https://github.com/maputnik/editor/issues/416>
|
||||
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}
|
||||
>
|
||||
<div className="maputnik-modal"
|
||||
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>
|
||||
<span className="maputnik-modal-header-space"></span>
|
||||
<button className="maputnik-modal-header-toggle"
|
||||
onClick={() => this.props.onOpenToggle(false)}
|
||||
onClick={this.onClose}
|
||||
data-wd-key={this.props["data-wd-key"]+".close-modal"}
|
||||
>
|
||||
<MdClose />
|
||||
|
|
Loading…
Reference in a new issue