Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ define([

/** @inheritdoc */
always: function (e) {
e.stopImmediatePropagation();
if (e && typeof e.stopImmediatePropagation === 'function') {
e.stopImmediatePropagation();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it happens to be undefined?

Copy link
Contributor Author

@0m3r 0m3r Jun 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the event e is undefined

function escapeKey lost event param
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Ui/view/base/web/js/modal/modal.js#L108

but for closeModal function event is required param
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Ui/view/base/web/js/modal/confirm.js#L89

always (sidebar.js:95)
closeModal (confirm.js:97)                  

closeModal: function (event, result) {
            result = result || false;

            if (result) {
                this.options.actions.confirm(event);
            } else {
                this.options.actions.cancel(event);
            }
            this.options.actions.always(event);
            this.element.bind('confirmclosed', _.bind(this._remove, this));

            return this._super();
        }

(anonymous) (jquery-ui.js:402)
escapeKey (modal.js:111)                   

                escapeKey: function () {
                    if (this.options.isOpen && this.modal.find(document.activeElement).length ||
                        this.options.isOpen && this.modal[0] === document.activeElement) {
                        this.closeModal();
                    }
                }

keyEventSwitcher (modal.js:180)
...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @0m3r, thanks for collaboration. I think that always method should always receive event object. The correct way to fix this issue is fixing the place where event object was lost

}
}
}
});
Expand Down