improve menu a hrefs

This commit is contained in:
Ruben Fiszel
2025-03-03 14:58:49 +01:00
parent 5e965aec15
commit 8e1e37bf9e
2 changed files with 1 additions and 10 deletions
@@ -68,7 +68,7 @@
<!--svelte-ignore a11y-no-static-element-interactions-->
{#if open}
<div use:melt={$menuElement} data-menu class="z-[6000]" on:click|stopPropagation>
<div use:melt={$menuElement} data-menu class="z-[6000]" on:click>
<div
class={twMerge(
'border w-56 origin-top-right rounded-md shadow-md focus:outline-none overflow-y-auto py-1',
@@ -1,19 +1,11 @@
<script lang="ts">
import { melt } from '@melt-ui/svelte'
import type { MenubarMenuElements } from '@melt-ui/svelte'
import { goto } from '$app/navigation'
export let href: string | undefined = undefined
export let disabled: boolean = false
export let target: string | undefined = undefined
export let item: MenubarMenuElements['item']
function handleClick(e: MouseEvent) {
if (href && !target) {
e.preventDefault()
goto(href)
}
}
</script>
{#if href}
@@ -25,7 +17,6 @@
aria-disabled={disabled}
tabindex={disabled ? -1 : undefined}
{target}
on:click={handleClick}
on:m-focusin
on:m-focusout
>