Skip to content

Anchor native select dropdowns on Android large screens - #5250

Merged
ymichael merged 1 commit into
get-bb:mainfrom
Willhong:fix/android-select-dropdown-anchor
Oct 9, 2026
Merged

ymichael merged 1 commit into
get-bb:mainfrom
Willhong:fix/android-select-dropdown-anchor

Conversation

@Willhong

@Willhong Willhong commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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 leaves 0,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]: RNCWebView overrides requestLayout(). 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 calls requestLayout() before field initializers run. pnpm-lock.yaml only 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

  • Built apps/mobile (pnpm build:android:dev) at main and at this branch. Ran both on an Android 16 emulator (WebView 133) against pnpm start:worktree on 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).
  • Unfolded-Fold-sized window (wm size 1856x2160, wm density 420):
    • Before: list at the top of the screen. dumpsys activity top shows the anchor at 0,0-0,0 with a pending layout.
    • After: list anchored to the field. The anchor is at 63,1183-1407,1285. Picking an option updates the field.
  • Phone-sized window: the centered picker dialog is unchanged.
  • Checked that the fix is in the build under test: the measureAndLayoutChildren symbol is in the after build's dex and not in the before build's.
  • Not run: the JS test suites, because this change is Java only. Not tested on a physical device yet.

Before and after on an unfolded-Fold-sized window

Fixes #5249

AGENT GENERATED

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T08:24:46.882666Z e57a7db PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@ymichael
ymichael merged commit d933fc2 into get-bb:main Oct 9, 2026
46 checks passed
@Willhong
Willhong deleted the fix/android-select-dropdown-anchor branch October 10, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android app: native <select> dropdown opens at the top of the screen on wide windows (tablets, unfolded Fold)

2 participants