diff --git a/packages/core/src/combobox/combobox-content.tsx b/packages/core/src/combobox/combobox-content.tsx index 35b1c2e2..ab33365e 100644 --- a/packages/core/src/combobox/combobox-content.tsx +++ b/packages/core/src/combobox/combobox-content.tsx @@ -120,7 +120,7 @@ export function ComboboxContent( createPreventScroll({ element: () => ref ?? null, - enabled: () => context.isOpen() && context.preventScroll(), + enabled: () => context.contentPresent() && context.preventScroll(), }); createFocusScope( diff --git a/packages/core/src/dialog/dialog-content.tsx b/packages/core/src/dialog/dialog-content.tsx index df3e8e1e..846bf6f9 100644 --- a/packages/core/src/dialog/dialog-content.tsx +++ b/packages/core/src/dialog/dialog-content.tsx @@ -202,7 +202,7 @@ export function DialogContent( createPreventScroll({ element: () => ref ?? null, - enabled: () => context.isOpen() && context.preventScroll(), + enabled: () => context.contentPresent() && context.preventScroll(), }); createFocusScope( diff --git a/packages/core/src/menu/menu-content.tsx b/packages/core/src/menu/menu-content.tsx index 1a661cc1..0556b9cf 100644 --- a/packages/core/src/menu/menu-content.tsx +++ b/packages/core/src/menu/menu-content.tsx @@ -37,7 +37,7 @@ export function MenuContent( createPreventScroll({ element: () => ref ?? null, - enabled: () => context.isOpen() && rootContext.preventScroll(), + enabled: () => context.contentPresent() && rootContext.preventScroll(), }); return ( diff --git a/packages/core/src/popover/popover-content.tsx b/packages/core/src/popover/popover-content.tsx index 29500b34..13e569ea 100644 --- a/packages/core/src/popover/popover-content.tsx +++ b/packages/core/src/popover/popover-content.tsx @@ -206,7 +206,7 @@ export function PopoverContent( createPreventScroll({ element: () => ref ?? null, - enabled: () => context.isOpen() && context.preventScroll(), + enabled: () => context.contentPresent() && context.preventScroll(), }); createFocusScope( diff --git a/packages/core/src/select/select-content.tsx b/packages/core/src/select/select-content.tsx index 6a97715d..310de3a0 100644 --- a/packages/core/src/select/select-content.tsx +++ b/packages/core/src/select/select-content.tsx @@ -111,7 +111,7 @@ export function SelectContent( createPreventScroll({ element: () => ref ?? null, - enabled: () => context.isOpen() && context.preventScroll(), + enabled: () => context.contentPresent() && context.preventScroll(), }); createFocusScope(