Repository navigation
Conversation
snowystinger
left a comment
There was a problem hiding this comment.
I took a brief look, this is way more changes than I was expecting, though most of it looks pretty straightforward. Can you check if building based on https://github.com/adobe/react-spectrum/pull/10558/changes would simplify things.
Test instructions in the PR description is so that a human can verify what going on. Saying that test pass doesn't really help us much, we can see that all the tests pass or fail in CI. If there isn't a way to do that, then please add some more tests and stories. Sidenote, it doesn't look like the tests open new windows? just iframes, which wasn't mentioned in the issue. I'm fine that this fixes those as well, but please add a story which shows the original bug.
| } | ||
| // Freeze positioning if the viewport is zoomed after opening the overlay. | ||
| let initialViewport = useRef<{viewport: VisualViewport; scale: number} | null>(null); | ||
| useLayoutEffect(() => { |
There was a problem hiding this comment.
why'd this change from a useEffect to a useLayoutEffect
|
|
||
| let visualViewport = getVisualViewport(); | ||
| let ownerWindow = getOwnerWindow(overlayNode); | ||
| let documentElement = overlayNode.ownerDocument.documentElement; |
There was a problem hiding this comment.
we have a getOwnerDocument helper as well that we should try to use
|
What happened? Why was this PR closed? did something not work? or did you not have time for further changes? |
Closes #10951.
Summary
Popovers in a secondary window can use the opener’s viewport for placement, stay in place when their own window resizes, or close when an unrelated element scrolls.
Use the overlay and trigger’s owning document and window for geometry, resize events, and scroll handling. Keep explicitly configured boundaries and continue dismissing when an ancestor of the trigger scrolls. Add browser regression tests for placement, resize, and scroll dismissal in a secondary document.
The proposed containing-element helper in #10558 could shorten the containing-block lookup once available. The viewport, scroll, and observer fixes use the DOM helpers already available on
main. The existing positioning callback now clears the recorded viewport scale when the popover closes.📝 Test Instructions
yarn start-parcel3and open React Aria Components → Popover → Secondary Window in Storybook.I ran the story in a real Chrome popup with both versions of the positioning code. With the original code, the popover opened below the button and was clipped, and scrolling the separate area dismissed it. With the fix, all four steps behaved as described. I ran the story component directly because the local Storybook build failed in Parcel on Windows. The broader local Jest and SSR runs hit failures in the Table and NumberField suites.
Release impact
✅ PR Checklist
🧢 Your Project
Independent open-source contribution, prepared with Codex assistance.