Skip to content

Commit f5179d9

Browse files
committed
fix(menu): revert change of backdrop click
1 parent 721bc45 commit f5179d9

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

core/src/components/menu/menu.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,20 @@ export class Menu implements ComponentInterface, MenuI {
322322
}
323323
}
324324

325+
@Listen('click', { capture: true })
326+
onBackdropClick(ev: any) {
327+
// TODO(FW-2832): type (CustomEvent triggers errors which should be sorted)
328+
if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) {
329+
const shouldClose = ev.composedPath ? !ev.composedPath().includes(this.menuInnerEl) : false;
330+
331+
if (shouldClose) {
332+
ev.preventDefault();
333+
ev.stopPropagation();
334+
this.close(undefined, BACKDROP);
335+
}
336+
}
337+
}
338+
325339
onKeydown(ev: KeyboardEvent) {
326340
if (ev.key === 'Escape') {
327341
this.close(undefined, BACKDROP);
@@ -724,19 +738,6 @@ export class Menu implements ComponentInterface, MenuI {
724738
}
725739
}
726740

727-
private onBackdropTap = (ev: any) => {
728-
// TODO(FW-2832): type (CustomEvent triggers errors which should be sorted)
729-
if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) {
730-
const shouldClose = ev.composedPath ? !ev.composedPath().includes(this.menuInnerEl) : false;
731-
732-
if (shouldClose) {
733-
ev.preventDefault();
734-
ev.stopPropagation();
735-
this.close(undefined, BACKDROP);
736-
}
737-
}
738-
};
739-
740741
private updateState() {
741742
const isActive = this._isActive();
742743
if (this.gesture) {
@@ -792,13 +793,18 @@ export class Menu implements ComponentInterface, MenuI {
792793
'menu-pane-visible': isPaneVisible,
793794
'split-pane-side': hostContext('ion-split-pane', el),
794795
}}
795-
onIonBackdropTap={this.onBackdropTap}
796796
>
797797
<div class="menu-inner" part="container" ref={(el) => (this.menuInnerEl = el)}>
798798
<slot></slot>
799799
</div>
800800

801-
<ion-backdrop ref={(el) => (this.backdropEl = el)} class="menu-backdrop" tappable={true} part="backdrop" />
801+
<ion-backdrop
802+
ref={(el) => (this.backdropEl = el)}
803+
class="menu-backdrop"
804+
tappable={false}
805+
stopPropagation={false}
806+
part="backdrop"
807+
/>
802808
</Host>
803809
);
804810
}

0 commit comments

Comments
 (0)