Skip to content

Commit

Permalink
fix(prevent-scroll): wait for presence to finish before enabling scro…
Browse files Browse the repository at this point in the history
…ll (#447)
  • Loading branch information
GiyoMoon authored Jul 22, 2024
1 parent 6cb0499 commit 4cf47c8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/combobox/combobox-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function ComboboxContent<T extends ValidComponent = "div">(

createPreventScroll({
element: () => ref ?? null,
enabled: () => context.isOpen() && context.preventScroll(),
enabled: () => context.contentPresent() && context.preventScroll(),
});

createFocusScope(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dialog/dialog-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export function DialogContent<T extends ValidComponent = "div">(

createPreventScroll({
element: () => ref ?? null,
enabled: () => context.isOpen() && context.preventScroll(),
enabled: () => context.contentPresent() && context.preventScroll(),
});

createFocusScope(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/menu/menu-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function MenuContent<T extends ValidComponent = "div">(

createPreventScroll({
element: () => ref ?? null,
enabled: () => context.isOpen() && rootContext.preventScroll(),
enabled: () => context.contentPresent() && rootContext.preventScroll(),
});

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/popover/popover-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function PopoverContent<T extends ValidComponent = "div">(

createPreventScroll({
element: () => ref ?? null,
enabled: () => context.isOpen() && context.preventScroll(),
enabled: () => context.contentPresent() && context.preventScroll(),
});

createFocusScope(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/select/select-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function SelectContent<T extends ValidComponent = "div">(

createPreventScroll({
element: () => ref ?? null,
enabled: () => context.isOpen() && context.preventScroll(),
enabled: () => context.contentPresent() && context.preventScroll(),
});

createFocusScope(
Expand Down

0 comments on commit 4cf47c8

Please sign in to comment.