Skip to content

Commit

Permalink
fix: context menu not closing when clicking a button in a dropdown menu
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Mar 8, 2024
1 parent c66ee09 commit e2c419a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@
export let item: MenuDropDownButton
export let className: string | undefined = undefined
export let onCloseContextMenu: () => void
$: items = item.items.map(item => ({
...item,
onClick: (event: MouseEvent) => {
onCloseContextMenu()
item.onClick(event)
}
}))
</script>

<DropdownButton width={item.width} items={item.items}>
<DropdownButton width={item.width} items={items}>
<button
class={classnames('jse-context-menu-button', className, item.main.className)}
type="button"
Expand Down
2 changes: 1 addition & 1 deletion src/routes/development/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
function onRenderContextMenu(items: ContextMenuItem[], context: RenderMenuContext) {
console.log('onRenderContextMenu', items, context)
return items // This return is equivalent to onRenderContextMenu is undefined
return items
}
function openInWindow() {
Expand Down

0 comments on commit e2c419a

Please sign in to comment.