Skip to content

Commit

Permalink
fix(player/react): click callbacks not working in menus
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Dec 20, 2023
1 parent 0a1cc02 commit fcb938f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/vidstack/src/components/ui/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,6 @@ export class Menu extends Component<MenuProps, {}, MenuEvents> {
this._content.set(el);
onDispose(() => this._content.set(null));

if (!this.isSubmenu) {
this._stopClickPropagation(el);
}

const watchAttrs = () => {
setAttribute(el, 'data-open', this._expanded());
};
Expand Down Expand Up @@ -369,6 +365,9 @@ export class Menu extends Component<MenuProps, {}, MenuEvents> {
}

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);
Expand Down

0 comments on commit fcb938f

Please sign in to comment.