Skip to content

Commit

Permalink
next: fix pointer event restoration (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Sep 29, 2024
1 parent 18c2ff1 commit d519a0e
Show file tree
Hide file tree
Showing 6 changed files with 5,437 additions and 6,418 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-suns-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

next: fix pointer event restoration
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
}}
preventScroll={false}
{loop}
trapFocus={false}
>
{#snippet popper({ props })}
{@const finalProps = mergeProps(props, mergedProps, {
Expand Down
3 changes: 3 additions & 0 deletions packages/bits-ui/src/lib/bits/menu/menu.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ class MenuContentState {
onblur: this.#onblur,
onpointermove: this.#onpointermove,
onfocus: this.#onfocus,
style: {
pointerEvents: "auto",
},
}) as const
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
{customAnchor}
>
{#snippet content({ props: floatingProps })}
<ScrollLock {preventScroll} />
{#if preventScroll}
<ScrollLock {preventScroll} />
{/if}
<FocusScope
{id}
{onOpenAutoFocus}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<script lang="ts">
import { untrack } from "svelte";
import type { ScrollLockProps } from "./index.js";
import { useBodyScrollLock } from "$lib/internal/useBodyScrollLock.svelte.js";
let { preventScroll = true }: ScrollLockProps = $props();
$effect(() => {
if (preventScroll) {
untrack(() => useBodyScrollLock(preventScroll));
}
});
useBodyScrollLock(preventScroll);
</script>
Loading

0 comments on commit d519a0e

Please sign in to comment.