Skip to content

Commit 8a8bd38

Browse files
committed
test: account for non-existent ResizeObserver
1 parent cb5e243 commit 8a8bd38

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/Dialog/hooks/usePopoverPosition.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
} from '@floating-ui/react';
1111
import type { AutoPlacementOptions } from '@floating-ui/core';
1212

13+
const hasResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window;
14+
1315
export type PopperLikePlacement = Placement | 'auto' | 'auto-start' | 'auto-end';
1416

1517
function autoMiddlewareFor(p: PopperLikePlacement) {
@@ -98,7 +100,7 @@ export function usePopoverPosition({
98100
ancestorResize: true,
99101
ancestorScroll: true,
100102
animationFrame: false,
101-
elementResize: true,
103+
elementResize: hasResizeObserver,
102104
...autoUpdateOptions,
103105
}),
104106
});

0 commit comments

Comments
 (0)