Description
This issue is automatically created based on existing pull request: #28906: Remove over complicated setup for closing minicart dropdown
Summary (*)
Magento 2.4-develop
When investigating minicart code I've noticed a bit strange way to add event listener to elements that are supposed to close minicart when clicked.
Please first look on removed line with data-bind="visible: closeSidebar()"
. visible
knockout binding is used to control whether the element should be shown. However, the closeSidebar
function is always returning true
value. The side effect of this function is it setup an event listeners to [data-action="close"]
elements, which will close the minicart dropdown.
This pull request removes closeSidebar
function and the knockout binding on completely unrelated element. Instead, the appropriate click binding is added to the only [data-action="close"]
element I've found.
Examples (*)
- Open minibasket
- Close with an "X" button
- Add a product to basket
- Open, close minibasket
- Open basket and click on "Proceed to Checkout"
Proposed solution
Questions or comments
I've searched the codebase for elements with data-action="close"
to ensure that it will not break any other functionality. However I'm guessing some modules may using this "API".
Other question is whether data-action="close"
attribute is needed. By searching in a code it doesn't seem to have a purpose, but it increase HTML to content ratio.
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- All automated tests passed successfully (all builds are green)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status