[Issue] Remove over complicated setup for closing minicart dropdown #29161
Labels
Component: Checkout
Fixed in 2.4.x
The issue has been fixed in 2.4-develop branch
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Issue: Format is valid
Gate 1 Passed. Automatic verification of issue format passed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Priority: P4
No current plan to fix. Fixing can be deferred as a logical part of more important work.
Progress: done
Reported on 2.4.0
Indicates original Magento version for the Issue report.
Reproduced on 2.4.x
The issue has been reproduced on latest 2.4-develop branch
Severity: S4
Affects aesthetics, professional look and feel, “quality” or “usability”.
Projects
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, thecloseSidebar
function is always returningtrue
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 (*)
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 (*)
The text was updated successfully, but these errors were encountered: