-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Remove over complicated setup for closing minicart dropdown #28906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove over complicated setup for closing minicart dropdown #28906
Conversation
Hi @lumnn. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. |
@magento run all tests Very interesting change. Let's make sure that everything works fine! |
I'm unsure why tests fails as from the reports I can't find that any of the issue is related to the changes I've done @magento run Functional Tests CE , Functional Tests B2B |
I guess it's worth noting that Functional Tests CE and Functional Tests B2B failed in the first go, but passed in second. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️ Wow. Great work! Thank you for your contribution.
Hi @lbajsarowicz, thank you for the review.
|
Hi @ptylek, thank you for the review.
|
Adding not required label as this PR improves on some redundant javascript. Functionality should stay the same. |
@magento create issue |
Hi @lumnn, thank you for your contribution! |
Description (*)
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.Manual testing scenarios (*)
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 (*)
Resolved issues: