Skip to content

Commit b7eb537

Browse files
author
Mikhail Bashkirov
committed
fix(button): make redispatch method protected
1 parent 59e456e commit b7eb537

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/button/src/LionButton.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,21 @@ export class LionButton extends DelegateMixin(SlotMixin(LionLitElement)) {
152152
this.__teardownDelegation();
153153
}
154154

155-
/**
156-
* Prevent click on the fake element and cause click on the native button.
157-
*/
158-
__clickDelegationHandler(oldEvent) {
159-
oldEvent.stopPropagation();
155+
_redispatchClickEvent(oldEvent) {
160156
// replacing `MouseEvent` with `oldEvent.constructor` breaks IE
161157
const newEvent = new MouseEvent(oldEvent.type, oldEvent);
162158
this.__enforceHostEventTarget(newEvent);
163159
this.$$slot('_button').dispatchEvent(newEvent);
164160
}
165161

162+
/**
163+
* Prevent click on the fake element and cause click on the native button.
164+
*/
165+
__clickDelegationHandler(e) {
166+
e.stopPropagation();
167+
this._redispatchClickEvent(e);
168+
}
169+
166170
__enforceHostEventTarget(event) {
167171
try {
168172
// this is for IE11 (and works in others), because `Object.defineProperty` does not give any effect there

0 commit comments

Comments
 (0)