From f647b7b96f863816dc2091368b57a5c29e55df78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Thu, 14 Jun 2018 07:23:31 +0200 Subject: [PATCH] Allow window drag during a modal without closing it --- src/components/base/Modal/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index 5d95bdff..02fec5ba 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -90,6 +90,15 @@ const Backdrop = styled(Box).attrs({ position: fixed; ` +const NonClickableHeadArea = styled.div` + position: fixed; + height: 48px; + width: 100%; + top: 0; + left: 0; + z-index: 1; +` + const Wrapper = styled(Box).attrs({ bg: 'transparent', flow: 4, @@ -119,6 +128,10 @@ class Pure extends Component { } } +function stopPropagation(e) { + e.stopPropagation() +} + export class Modal extends Component { static defaultProps = { isOpened: false, @@ -183,13 +196,14 @@ export class Modal extends Component { {(m, isVisible, isAnimated) => ( + (this._wrapper = n)} - onClick={e => e.stopPropagation()} + onClick={stopPropagation} >