Skip to content

Commit

Permalink
fix(player): submenus not showing
Browse files Browse the repository at this point in the history
closes #1389, #1386
  • Loading branch information
mihar-22 committed Aug 12, 2024
1 parent 93cd839 commit 4b23c60
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions packages/vidstack/src/components/ui/menu/menu-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,32 @@ export class MenuItems extends Component<MenuItemsProps> {
if (!this.el || !expanded()) return;

const placement = this.$props.placement();
if (!placement) return;

if (placement) {
Object.assign(this.el.style, {
position: 'absolute',
top: 0,
left: 0,
width: 'max-content',
});
Object.assign(this.el.style, {
position: 'absolute',
top: 0,
left: 0,
width: 'max-content',
});

const { offset: mainOffset, alignOffset } = this.$props;

const { offset: mainOffset, alignOffset } = this.$props;
return autoPlacement(this.el, this.#getButton(), placement, {
onDispose(
autoPlacement(this.el, this.#getButton(), placement, {
offsetVarName: 'media-menu',
xOffset: alignOffset(),
yOffset: mainOffset(),
});
} else {
this.el.removeAttribute('style');
this.el.style.display = 'none';
}
}),
);

onDispose(this.#hide.bind(this));
}

#hide() {
if (!this.el) return;
this.el.removeAttribute('style');
this.el.style.display = 'none';
}

#getButton() {
Expand Down

0 comments on commit 4b23c60

Please sign in to comment.