Skip to content

Commit

Permalink
fix(next): preventScroll to true by default on context-menu (#709)
Browse files Browse the repository at this point in the history
Co-authored-by: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com>
Co-authored-by: Hunter Johnston <64506580+huntabyte@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 27ad54c commit 97bd443
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-pandas-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

set `preventScroll` to `true` by default on `ContextMenu`
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ref = $bindable(null),
loop = true,
onInteractOutside = noop,
preventScroll = true,
// we need to explicitly pass this prop to the PopperLayer to override
// the default menu behavior of handling outside interactions on the trigger
onEscapeKeydown = noop,
Expand Down Expand Up @@ -55,6 +56,7 @@
{...mergedProps}
present={contentState.parentMenu.open.current || forceMount}
onInteractOutsideStart={handleInteractOutsideStart}
{preventScroll}
onInteractOutside={(e) => {
onInteractOutside(e);
if (e.defaultPrevented) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ref = $bindable(null),
loop = true,
onInteractOutside = noop,
preventScroll = true,
// we need to explicitly pass this prop to the PopperLayer to override
// the default menu behavior of handling outside interactions on the trigger
onEscapeKeydown = noop,
Expand Down Expand Up @@ -57,6 +58,7 @@
sideOffset={2}
align="start"
present={contentState.parentMenu.open.current || forceMount}
{preventScroll}
onInteractOutsideStart={handleInteractOutsideStart}
onInteractOutside={(e) => {
onInteractOutside(e);
Expand Down

0 comments on commit 97bd443

Please sign in to comment.