diff --git a/packages/scandipwa/src/component/ClickOutside/ClickOutside.component.tsx b/packages/scandipwa/src/component/ClickOutside/ClickOutside.component.tsx index 3e28f0175a..5fa7751c1b 100644 --- a/packages/scandipwa/src/component/ClickOutside/ClickOutside.component.tsx +++ b/packages/scandipwa/src/component/ClickOutside/ClickOutside.component.tsx @@ -39,14 +39,20 @@ export class ClickOutsideComponent extends PureComponent createRef(), ) || []; } componentDidMount(): void { - document.addEventListener('click', this.handleClick); + /* + * delaying adding the clickoutside event because of the issue with popup, + * where event was triggered immediatly + * vvv + */ + setTimeout(() => { + document.addEventListener('click', this.handleClick); + }, 0); } componentWillUnmount(): void { diff --git a/packages/scandipwa/src/component/NavigationAbstract/NavigationAbstract.container.tsx b/packages/scandipwa/src/component/NavigationAbstract/NavigationAbstract.container.tsx index 1eaa271856..967f5c3513 100644 --- a/packages/scandipwa/src/component/NavigationAbstract/NavigationAbstract.container.tsx +++ b/packages/scandipwa/src/component/NavigationAbstract/NavigationAbstract.container.tsx @@ -59,6 +59,13 @@ State extends NavigationAbstractContainerState, setNavigationState(this.getNavigationState()); history.listen((history) => { + const { state } = history; + + // vvv ignoring the route change for popup + if (state && state.popupOpen) { + return; + } + this.handlePageScroll(); this.setState(this.onRouteChanged(history)); }); diff --git a/packages/scandipwa/src/component/Popup/Popup.container.tsx b/packages/scandipwa/src/component/Popup/Popup.container.tsx index 978f820a26..bbdb578842 100644 --- a/packages/scandipwa/src/component/Popup/Popup.container.tsx +++ b/packages/scandipwa/src/component/Popup/Popup.container.tsx @@ -20,6 +20,7 @@ import { hideActiveOverlay, hideActivePopup } from 'Store/Overlay/Overlay.action import { PopupPayload } from 'Store/Popup/Popup.type'; import { ReactElement } from 'Type/Common.type'; import { noopFn } from 'Util/Common'; +import history from 'Util/History'; import { RootState } from 'Util/Store/Store.type'; import Popup from './Popup.component'; @@ -75,7 +76,7 @@ export class PopupContainer extends PureComponent { name: Page.POPUP, title: this._getPopupTitle(), onCloseClick: () => { - history.back(); + history.goBack(); }, }); @@ -99,7 +100,6 @@ export class PopupContainer extends PureComponent { contentMix, onClose, onHide, - onVisible, shouldPopupClose, hideActiveOverlay, resetHideActivePopup, @@ -120,7 +120,6 @@ export class PopupContainer extends PureComponent { shouldPopupClose, onClose, onHide, - onVisible, hideActiveOverlay, resetHideActivePopup, goToPreviousNavigationState, diff --git a/packages/scandipwa/src/component/Product/Product.component.tsx b/packages/scandipwa/src/component/Product/Product.component.tsx index 4c8d13aa74..4994dcb10b 100644 --- a/packages/scandipwa/src/component/Product/Product.component.tsx +++ b/packages/scandipwa/src/component/Product/Product.component.tsx @@ -86,7 +86,6 @@ export class ProductComponent

); } diff --git a/packages/scandipwa/src/component/Router/Router.component.tsx b/packages/scandipwa/src/component/Router/Router.component.tsx index 5048de19e8..24079c545b 100644 --- a/packages/scandipwa/src/component/Router/Router.component.tsx +++ b/packages/scandipwa/src/component/Router/Router.component.tsx @@ -384,10 +384,10 @@ export class RouterComponent extends PureComponent -

- { this.renderMainItems() } -
- { this.renderSectionOfType(RouterItemType.AFTER_ITEMS_TYPE) } +
+ { this.renderMainItems() } +
+ { this.renderSectionOfType(RouterItemType.AFTER_ITEMS_TYPE) } ); } diff --git a/packages/scandipwa/src/route/ProductComparePage/ProductComparePage.container.tsx b/packages/scandipwa/src/route/ProductComparePage/ProductComparePage.container.tsx index 3b56c046c7..19f55c2b72 100644 --- a/packages/scandipwa/src/route/ProductComparePage/ProductComparePage.container.tsx +++ b/packages/scandipwa/src/route/ProductComparePage/ProductComparePage.container.tsx @@ -19,6 +19,7 @@ import { NavigationType } from 'Store/Navigation/Navigation.type'; import { showNotification } from 'Store/Notification/Notification.action'; import { ReactElement } from 'Type/Common.type'; import { scrollToTop } from 'Util/Browser'; +import history from 'Util/History'; import DataContainer from 'Util/Request/DataContainer'; import { RootState } from 'Util/Store/Store.type'; @@ -100,7 +101,7 @@ export class ProductComparePageContainer extends DataContainer history.back(), + onBackClick: () => history.goBack(), }); }