From e239b818d1c4eef1c020cec4786b079789148718 Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Thu, 24 Jul 2025 15:50:57 -0700 Subject: [PATCH] fix flip behavior for select in dialog --- packages/@react-aria/overlays/src/calculatePosition.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@react-aria/overlays/src/calculatePosition.ts b/packages/@react-aria/overlays/src/calculatePosition.ts index 2e929bdbfb7..43979275a9b 100644 --- a/packages/@react-aria/overlays/src/calculatePosition.ts +++ b/packages/@react-aria/overlays/src/calculatePosition.ts @@ -350,9 +350,10 @@ export function calculatePositionInternal( padding + offset, placementInfo ); + let renderedSize = userSetMaxHeight ?? scrollSize[size]; // Check if the scroll size of the overlay is greater than the available space to determine if we need to flip - if (flip && scrollSize[size] > space) { + if (flip && renderedSize > space) { let flippedPlacementInfo = parsePlacement(`${FLIPPED_DIRECTION[placement]} ${crossPlacement}` as Placement); let flippedPosition = computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset); let flippedSpace = getAvailableSpace(