From fcb938fa420f871d2fb833a65e1b66f12da94f44 Mon Sep 17 00:00:00 2001 From: Rahim Alwer Date: Wed, 20 Dec 2023 15:47:42 +1100 Subject: [PATCH] fix(player/react): click callbacks not working in menus --- packages/vidstack/src/components/ui/menu/menu.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/vidstack/src/components/ui/menu/menu.ts b/packages/vidstack/src/components/ui/menu/menu.ts index 1c91dc5f1..a5d011b7d 100644 --- a/packages/vidstack/src/components/ui/menu/menu.ts +++ b/packages/vidstack/src/components/ui/menu/menu.ts @@ -235,10 +235,6 @@ export class Menu extends Component { this._content.set(el); onDispose(() => this._content.set(null)); - if (!this.isSubmenu) { - this._stopClickPropagation(el); - } - const watchAttrs = () => { setAttribute(el, 'data-open', this._expanded()); }; @@ -369,6 +365,9 @@ export class Menu extends Component { } private _onWindowPointerUp(event: Event) { + const isTargetNode = event.target instanceof Node; + if (!isTargetNode || this._content()?.contains(event.target)) return; + // A little delay so submenu closing doesn't jump menu size when closing. if (this.isSubmenu) return setTimeout(this.close.bind(this, event), 800); else this.close(event);