Skip to content

Commit

Permalink
fix: requesting items on homepage not working (#154)
Browse files Browse the repository at this point in the history
* fix: requesting items on homepage not working

* fix: lint
  • Loading branch information
davidemarcoli authored Oct 26, 2024
1 parent 50ba5a9 commit b874092
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/components/home-items.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
export let type: string;
const hoveredItem = writable(null);
const handleMouseLeave = (e: MouseEvent) => {
// Only reset hoveredItem if we're not hovering over a child element
const currentTarget = e.currentTarget as HTMLElement;
const relatedTarget = e.relatedTarget as HTMLElement;
if (currentTarget.contains(relatedTarget)) {
$hoveredItem = null;
}
};
</script>

<div class="flex h-full w-full flex-col p-8 md:px-24 lg:px-32">
Expand All @@ -35,7 +44,7 @@
role="button"
tabindex="0"
on:mouseenter={() => ($hoveredItem = item.id)}
on:mouseleave={() => ($hoveredItem = null)}
on:mouseleave={handleMouseLeave}
on:focus={() => ($hoveredItem = item.id)}
on:blur={() => ($hoveredItem = null)}
on:keydown={(e) => {
Expand Down

0 comments on commit b874092

Please sign in to comment.