Repository navigation
Anchor native select dropdowns on Android large screens - #5250
Conversation
On wide Android windows (tablets, an unfolded Galaxy Fold) the WebView opens a <select> as a dropdown anchored to a child view that Chromium adds to the WebView. React Native drops layout requests from views it did not create, so that anchor stays at 0,0 and the dropdown opens at the top of the screen, under the status bar, instead of under the field (react-native-webview#3424). RNCWebView now measures and lays out its own children when one of them requests layout, so the anchor sits on the field. Phones keep the centered picker dialog, which needs no anchor.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e57a7db47e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| + return super.onApplyWindowInsets(adjusted); | ||
| + } | ||
| + | ||
| + // On large screens Chromium anchors a <select> dropdown to a child view it adds to this |
There was a problem hiding this comment.
Remove the added Java comments
The two added // blocks become Java source when pnpm applies this dependency patch, but the repository explicitly forbids code comments except semantic directives and Plugin SDK declarations. Remove the prose from the patch and keep the rationale in project documentation or the commit message so the shipped source follows the project-wide contract.
AGENTS.md reference: AGENTS.md:L11-L11
Useful? React with 👍 / 👎.
Human comments
What was wrong
On wide Android windows (tablets, an unfolded Galaxy Fold), Chromium opens a native
<select>as a dropdown anchored to a child view it adds to the WebView (dropdown_popup_window). React Native drops layout requests from views it did not create, so that anchor never leaves0,0. The option list then opens at the top-left of the WebView, under the status bar, instead of next to the field. Phones use the centered picker dialog, which needs no anchor. This is react-native-webview#3424, still unfixed upstream as of v16.0.0.What changed
patches/[email protected]:RNCWebViewoverridesrequestLayout(). When a child asks for layout, it posts one pass that measures and lays out the WebView at its current size. That lets the WebView place its own children, so the anchor lands on the field. The override checks for its field because the WebView constructor callsrequestLayout()before field initializers run.pnpm-lock.yamlonly updates the patch hash.No other behavior changes. The pass keeps the WebView's React Native size: it measures with its current width and height and lays out at its current bounds.
How you verified
apps/mobile(pnpm build:android:dev) atmainand at this branch. Ran both on an Android 16 emulator (WebView 133) againstpnpm start:worktreeon a clean data dir, with a minimal plugin page that has a native<select>(repro in Android app: native<select>dropdown opens at the top of the screen on wide windows (tablets, unfolded Fold) #5249).wm size 1856x2160,wm density 420):dumpsys activity topshows the anchor at0,0-0,0with a pending layout.63,1183-1407,1285. Picking an option updates the field.measureAndLayoutChildrensymbol is in the after build's dex and not in the before build's.Fixes #5249