mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed popup close on clicking outside content
no refs - Popup was not closing when clicked outside in the empty area as listener was firing on wrong element
This commit is contained in:
parent
2ed016f7d8
commit
f4f037452d
1 changed files with 8 additions and 1 deletions
|
@ -74,6 +74,13 @@ class PopupContent extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePopupClose(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.target === e.currentTarget) {
|
||||||
|
this.context.onAction('closePopup');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderActivePage() {
|
renderActivePage() {
|
||||||
const {page} = this.context;
|
const {page} = this.context;
|
||||||
getActivePage({page});
|
getActivePage({page});
|
||||||
|
@ -139,7 +146,7 @@ class PopupContent extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'gh-portal-popup-wrapper ' + pageClass}>
|
<div className={'gh-portal-popup-wrapper ' + pageClass} onClick={e => this.handlePopupClose(e)}>
|
||||||
<div className={(hasMode(['preview', 'dev']) ? 'gh-portal-popup-container preview' : 'gh-portal-popup-container') + ' ' + popupWidthStyle + ' ' + pageClass} style={pageStyle} ref={node => (this.node = node)} tabIndex="-1">
|
<div className={(hasMode(['preview', 'dev']) ? 'gh-portal-popup-container preview' : 'gh-portal-popup-container') + ' ' + popupWidthStyle + ' ' + pageClass} style={pageStyle} ref={node => (this.node = node)} tabIndex="-1">
|
||||||
<CookieDisabledBanner message={cookieBannerText} />
|
<CookieDisabledBanner message={cookieBannerText} />
|
||||||
{this.renderPopupNotification()}
|
{this.renderPopupNotification()}
|
||||||
|
|
Loading…
Add table
Reference in a new issue