Making sure radio input is clickable without following the link

This commit is contained in:
koloml committed 2025-02-18 01:14:44 +04:00
1 parent 5a07fa3d60
commit dff77391b0
1 file changed
+6 -1
+6 -1
View File
@@ -22,10 +22,15 @@
onclick,
oninput,
}: MenuRadioItemProps = $props();
function stopPropagationAndPassCallback(originalEvent: MouseEvent) {
originalEvent.stopPropagation();
onclick?.(originalEvent as MouseEvent & { currentTarget: HTMLInputElement });
}
</script>
<MenuLink {href}>
<input {checked} {name} {onclick} {oninput} type="radio" {value}>
<input {checked} {name} onclick={stopPropagationAndPassCallback} {oninput} type="radio" {value}>
{@render children?.()}
</MenuLink>