Repository navigation
Conversation
|
Before we review, please sign the CLA. You'll need to close and reopen the PR to rerun the check. |
snowystinger
left a comment
There was a problem hiding this comment.
Need more info for reproduction #10891 (comment) so we can verify the changes.
|
I added a reduced runnable reproduction, StackBlitz import link, exact interaction steps, and the recorded iOS viewport measurements in the issue reply. The standalone page is verified to build and open in desktop Chrome; its exact iOS Safari failure state still needs confirmation. |
|
Hello, in case this is helpful: here is a reproduction on the current releases. Without this PR, an upward popover shrinks to almost nothing above the iOS keyboard. With it, the popover shows in full. Setup
Steps: open the page below, tap the textarea so the keyboard opens, then type
iOS 26.5 and 26.2 give the same numbers. When the keyboard opens, Safari scrolls the document by 310px and also reports No custom import { useRef, useState } from "react";
import { createRoot } from "react-dom/client";
import { ListBox, ListBoxItem, Popover } from "react-aria-components";
const channels = ["general", "design", "release", "support", "random", "ops"];
function App() {
const textarea = useRef(null);
const [text, setText] = useState("");
return (
<div className="app">
<main>{Array.from({ length: 30 }, (_, i) => <p key={i}>Message {i + 1}</p>)}</main>
<footer>
<textarea ref={textarea} rows={1} value={text} onChange={(e) => setText(e.target.value)} aria-label="Message" />
<Popover triggerRef={textarea} isOpen={text.endsWith("#")} isNonModal placement="top start" offset={6} className="popover">
<ListBox aria-label="Channels" items={channels.map((id) => ({ id }))}>
{(item) => <ListBoxItem id={item.id}>{item.id}</ListBoxItem>}
</ListBox>
</Popover>
</footer>
</div>
);
}
createRoot(document.getElementById("root")).render(<App />);html, body, #root { height: 100%; margin: 0; font: 16px -apple-system, sans-serif; }
.app { height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; overflow: auto; padding: 0 16px; }
footer { padding: 8px 16px 16px; border-top: 1px solid #ddd; }
textarea { box-sizing: border-box; width: 100%; font-size: 16px; padding: 8px; }
.popover { background: #fff; border: 1px solid #ccc; border-radius: 8px; padding: 4px; overflow: auto; min-width: 200px; }Use Our app hit the same problem. There, the same viewport values give 5px without the change and 315px with it. |
|
Just linking a related PR #11073 so that we're aware of possible merge conflicts down the line |
Closes #10891
Intent
Keep an upward popover's choices visible above the iOS software keyboard when WebKit reports a
visualViewport.offsetTopthat disagrees with the layout viewport coordinates used for the trigger and boundary. In the reported case, the mismatch reduces the popover'smax-heightto zero.Change
getMaxHeightnow reads the visual viewport's top from the existinggetContainerDimensions(document.body, visualViewport)calculation. That calculation already usespageTopand the document scroll, and it has a separate WebKit pinch zoom path. Reading frombodyalso preserves documents that scroll onbodyrather thanhtml. The boundary and placement calculations remain otherwise unchanged.The regression tests use the recorded iOS geometry (
pageTop466,offsetTop310, document scroll 466, visual viewport height 404, trigger top 214). They exercise both the positioning calculation and the rendereduseOverlayPositionhook. A second calculation case covers body-only scrolling. All three cases fail against the previousoffsetTopcalculation and pass with this change.✅ Pull Request Checklist:
📝 Test Instructions:
yarn test packages/react-aria/test/overlays/calculatePosition.test.ts packages/react-aria/test/overlays/useOverlayPosition.test.tsx --runInBand.visualViewport.offsetTopis positive butpageTop - document scrollis zero.Automated verification
yarn lint— passed (format, types, oxlint, package lint and constraints).yarn test --maxWorkers=4 --silent— 384 suites passed, 8,176 tests passed, 16 skipped, 262 snapshots passed. Jest reported a worker teardown warning after completion.yarn test:ssr --silent— 60 suites and 74 tests passed.yarn vitest run --config=vitest.browser.config.ts --project chromium-desktop --project webkit-desktop --maxWorkers=1) — 37 files and 297 tests passed, 33 skipped.yarn test:browserrun failed with four TokenField timeouts, one WebKit ComboBox opening failure, and a Firefox session connection error. The failed TokenField files and WebKit ComboBox file passed when isolated; the complete Chromium and WebKit rerun above passed. Firefox still cannot connect even for a single overlay test, and a standalone Playwright Firefox launch hangs on this workstation. Firefox browser verification remains open.The original keyboard failure was observed on an iPhone 17 Simulator running iOS 26.5. The new upstream source has a deterministic hook regression test; it has not yet been retested on the Simulator.
🧢 Your Project:
Independent application using React Aria.