magento2: Avoid scrolling down while block-minicart has an hover effect

Preconditions Happening in Magento 2.1.4 After testing and testing i’ve checked what was actually the issue so when the Icon cart must show you the list of items added to the cart with hover instead of click it presents this problem

Steps to Reproduce:

  1. Make sure that the icon cart has an hover effect to the minicart in order to show the list items:

<div class="block block-minicart empty"
    data-role="dropdownDialog"
    data-mage-init='{"dropdownDialog":{
                "triggerEvent" : "hover",
                "appendTo":"[data-block=minicart]",
                "triggerTarget":".showcart",
                "timeout": "200",
                "closeOnMouseLeave": true,
                "closeOnEscape": true,
                "triggerClass":"active",
                "parentClass":"active",
                "buttons":[]}}'>
            <div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
                <!-- ko template: getTemplate() --><!-- /ko -->
            </div>
        </div>
  1. Add to the cart a product (it doesnt matter the product type).
  2. Don’t do any click in other part of the page, just go directly with the mouse directly to the icon cart.
  3. Move your mouse off of the icon cart and when the popup dissapears the page will scroll down automatically the page. .

Expected Result: Avoid the scroll down automatically while you are in list of products after moving the mouse off of popup list items

Actual Result: Scrolling down automatically after popup modal dissapears.

Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Hello everyone i got the solution for the issue.

Results here that you have to add on minicart.js the following

miniCart.on('dropdowndialogclose', function(){
        $(window).scrollTop(0);
    });

When it closes the popup from the minicart that event (dropdowndialogclose) you have to add and force the scroll up to the top. I suggest use only if you add the hover effect on dropdownDialog.

Thanks, hope this helps to the ones who has faced this issue.

Hello, I have this problem also. Any ideas?

Hi, I have the same problem. Any ideas?