Repository navigation
Conversation
The bottom of the visual viewport was never converted to the container's coordinates, so the max height shrank by the page scroll when overlays were portalled into a positioned container. Use the container's position in the viewport to convert it.
There was a problem hiding this comment.
The changes here look bigger than in the stackblitz, what happened?
can you include a storybook story so we can manually verify the PR?
also, it looks like a human wasn't included in the review before submitting, please have your human review your code
Thank you for the review! I have gone through this myself and decided to stick with a much simpler version. The first one passed the container's position through two functions as an extra parameter, while the StackBlitz used a global, so it looked smaller. It's now stored with the container's other dimensions. I have also added a story to test it locally (steps are in the description) and updated the StackBlitz to match. The story sets I am happy to answer any further questions or concerns you may have. Cheers! |
snowystinger
left a comment
There was a problem hiding this comment.
Thank you, that looks better. I've verified the behaviour in the storybook and ran chromatic on this build, it passed.
|
Brilliant! @yihuiliao the previous approval was dismissed by the new commit, have you got a minute to take a second look? Thank you. |
Closes #11072
Summary
When overlays are portalled into a positioned container, a popover's
max-heightshrinks by the page scroll and can reach 0. It should use the space visible below its trigger.getMaxHeightcompared the bottom of the window with the popover's position in the container. This subtracts the container's top in the viewport, so both use the same coordinates.The one-line change in the issue fixes the reported case, but makes popovers too tall with a scrolled
position: relativebody, or with a portal container when pinch zoomed.📝 Test Instructions
yarn start-parcel3and open React Aria Components → Popover → Scrolled Portal Container.isBodyPositionedoff, scroll until the button is near the top, then open the popover. It should fill the space below the button. Without this fix, it collapses to an empty sliver.isBodyPositionedon and repeat. It should look the same. This case already works onmain, and checks that the fix doesn't break it.This StackBlitz compares the released code, the one-line change and this fix.
yarn test:browser useOverlayPositionpasses in Chromium and Firefox locally, and in WebKit on CI. The new portal container test fails without this fix. Pinch zoom is tested with a mocked viewport, not on a real device.Release impact
✅ PR Checklist
AI assistance was used for this change.
🧢 Your Project