Skip to content

[Issue] Remove over complicated setup for closing minicart dropdown #29161

Closed
@m2-assistant

Description

@m2-assistant

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 (*)

  1. Open minibasket
  2. Close with an "X" button
  3. Add a product to basket
  4. Open, close minibasket
  5. 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

No one assigned

    Labels

    Component: CheckoutFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P4No current plan to fix. Fixing can be deferred as a logical part of more important work.Progress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S4Affects aesthetics, professional look and feel, “quality” or “usability”.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions