#7990 · Native shell leaves page scaling unconstrained
PARTIALLY REPRODUCED · Root-cause confidence: medium
1. TL;DR
The reported symptom is whole-shell magnification after a native iOS pinch or double-tap. In two clean checkouts, the actual native bridge installs successfully but leaves the production app shell's viewport without a maximum scale or a user-scaling restriction. Trusted source also contains no native shell zoom override. This makes the report plausible, but it does not prove how WKWebView handles either gesture. This Linux host has no iOS simulator or connected device, so neither gesture nor its visual outcome was reproduced; this report deliberately does not claim a confirmed reproduction.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| The shell leaves page zoom at its defaults. | Verified as configuration, not as a live gesture. | The shell WebView supplies no zoom policy; the real bridge script leaves the viewport unchanged. |
| Pinch and double-tap magnify the native iOS shell. | Unverified. | No iOS runtime is available. Pinch and double-tap must each be tested on WKWebView. |
| The viewport permits scaling. | Verified for the actual app shell. | apps/app/index.html has initial scale only. The cited marketing-web root is not the server-served app shell. |
| Android has the same visible behavior. | Unverified. | The Android control is omitted, but no Android runtime was exercised. |
| This is distinct from input-focus zoom and image transforms. | Distinct code paths; runtime separation unverified. | The probe uses no text focus and no image pan/zoom. No global browser policy change is proposed. |
3. Environment
- Trusted repository: public
get-bb/bb.origin/mainwas fetched directly from that repository and resolved to the full commit above. - Linux, Node
v22.19.0, pnpm9.15.0; the lockfile pinsreact-native-webview 14.0.1with the repository's existing patch. - Two newly created detached worktrees, designated
base/andverify/, both at that commit. Each had a clean Git status before its successful probe. - No server, app instance, provider, device, simulator, ports, or application data directory was used. No dependencies or production files were changed.
4. Minimal reproduction
Scope: this is an executable bridge/viewport diagnostic, not an iOS gesture regression test. It reads the real production shell viewport and executes the real generated iOS bridge script with a minimal viewport DOM stand-in. It checks bridge installation before checking viewport state, preventing an import or setup error from being mistaken for the intended failure.
- Make a clean checkout at the recorded commit and install the frozen lockfile.
- Save the inline report-only probe as
viewport-probe.mjsnext to the checkout. Run the commands below. - Compare the output and exit status against the saved runs. The expected scale-1 policy would restrict the native page; the actual observed bridge leaves the viewport unconstrained. A native implementation could enforce scale without changing viewport metadata, so this probe alone is not a complete regression test for a fix.
git clone --branch main https://github.com/get-bb/bb.git bb-7990 cd bb-7990 git checkout --detach 35a03bbbb3f4d8dc814c1a152db5a463102b4250 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build pnpm exec turbo run test --filter=@bb/mobile-bridge --filter=@bb/mobile # Save viewport-probe.mjs from this report outside the checkout, then run: pnpm exec node --import tsx ../viewport-probe.mjs . # Expected probe status: 1. This is a viewport-policy failure, not a native gesture reproduction. # Repeat these steps in a second clean checkout at the same commit.
Observed output in both checkouts (exit 1):
native bridge installed: true viewport before: width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content viewport after: width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content viewport disallows page zoom: false native pinch/double-tap: NOT EXECUTED (requires iOS device or simulator) FAIL: native bridge leaves the shell viewport unconstrained
No native screenshots are supplied because no native gesture was executed. A desktop or synthetic screenshot would not establish this visual bug.
Full executable probe
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { pathToFileURL } from "node:url";
import { runInNewContext } from "node:vm";
const repository = resolve(process.argv[2] ?? process.cwd());
const { buildBridgeInjectionScript } = await import(
pathToFileURL(resolve(repository, "packages/mobile-bridge/src/inject.ts"))
);
const { MOBILE_BRIDGE_VERSION } = await import(
pathToFileURL(resolve(repository, "packages/mobile-bridge/src/version.ts"))
);
const shellHtml = readFileSync(resolve(repository, "apps/app/index.html"), "utf8");
const viewportContent = shellHtml.match(
/<meta\s+name="viewport"\s+content="([^"]+)"/u,
)?.[1];
assert.ok(viewportContent, "the production app shell must supply a viewport");
const attributes = new Map([
["name", "viewport"],
["content", viewportContent],
]);
const viewport = {
get content() {
return attributes.get("content");
},
set content(value) {
attributes.set("content", value);
},
getAttribute(name) {
return attributes.get(name) ?? null;
},
setAttribute(name, value) {
attributes.set(name, value);
},
};
const document = {
querySelector(selector) {
assert.equal(selector, 'meta[name="viewport"]');
return viewport;
},
};
const window = {
location: { href: "https://shell.invalid/threads/probe" },
ReactNativeWebView: { postMessage() {} },
};
const handshake = {
bridgeVersion: MOBILE_BRIDGE_VERSION,
appVersion: "0.0.1",
platform: "ios",
profileMode: "direct",
secureContext: true,
safeArea: { top: 0, right: 0, bottom: 0, left: 0 },
capabilities: [],
};
runInNewContext(buildBridgeInjectionScript(handshake), { window, document });
assert.equal(window.bb?.native?.platform, "ios", "bridge installation must succeed");
console.log("native bridge installed: true");
console.log(`viewport before: ${viewportContent}`);
console.log(`viewport after: ${viewport.content}`);
const directives = new Map(
viewport.content.split(",").map((directive) => {
const [name, value] = directive.trim().toLowerCase().split("=");
return [name, value];
}),
);
const scaleConstrained =
directives.get("maximum-scale") === "1" ||
["no", "0"].includes(directives.get("user-scalable"));
console.log(`viewport disallows page zoom: ${scaleConstrained}`);
console.log("native pinch/double-tap: NOT EXECUTED (requires iOS device or simulator)");
if (!scaleConstrained) {
console.log("FAIL: native bridge leaves the shell viewport unconstrained");
process.exitCode = 1;
}
5. Root cause
Demonstrated gap: native-shell setup does not establish a scale-1 page policy. Probable symptom mechanism: WKWebView is allowed to use its normal page-zoom behavior. Confidence is medium for the reported native symptom and high only for the observed missing viewport constraint.
apps/mobile/src/lib/shell/shell-url.tsconstructs the shell URL from the paired server, not the public marketing site.apps/server/src/start-server.tsselects the app distribution;apps/server/src/server.tsserves itsindex.html.apps/app/index.htmlcontains the app viewport:<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, interactive-widget=resizes-content" />
Initial scale determines startup scaling, not a locked scale.apps/mobile/src/screens/webview/ProfileWebViewScreen.tsxsupplies scrolling, media, and inset options and injectsbuildBridgeInjectionScript. None of those options explicitly constrains page zoom. Itsapps/mobile/src/screens/webview/ProfileWebViewScreen.tsxwrapper only forwards the props and source.packages/mobile-bridge/src/inject.tsfinishes installation immediately after assigning the native API:native.__apply(handshake); root.native = native;
The probe confirms successful installation without any viewport policy being applied. Inspection of the locked WebView native implementation found no BB page-zoom override in its existing patch.
The marketing route apps/web/src/routes/__root.tsx is not used as root-cause evidence. Its permissive viewport is not proof about the paired-server shell.
6. Proposed fix and safety gate
Next experiment: run this trusted commit in an iOS simulator or on a device with a fresh paired test server. Record visualViewport.scale and the native scroll view zoom scale before and after both pinch and double-tap on the shell, including after navigation. Repeat around the composer, an image viewer, and embedded preview content.
If that confirms native page magnification, constrain zoom in the native shell's own lifecycle, preserving ordinary browser accessibility zoom and any app-local image gestures. If changing the viewport, preserve viewport-fit=cover and interactive-widget=resizes-content. Verify both initial load and navigation. Android requires its own runtime check.
No fix branch or pull request was created. The automation permits fixes only after a faithful reproduction on trusted main and a focused test that fails before and passes after. Neither native gesture is reproduced here, and the report-only viewport probe cannot prove a native gesture repair. A dependency patch or lockfile modification would also fail this run's simple-fix constraints.
7. Linked pull request: #7991
PR #7991 is closed and unmerged, not an open duplicate. Only its GitHub metadata and diff were read as untrusted data; its branch, patch, and tests were never checked out or run.
The diff proposes native WebView gesture changes, injected viewport and gesture handling, Android options, tests, and documentation. It touches six files including a dependency patch and the lockfile; that proposal is outside this automation's simple-fix limits.
Static finding (medium): the proposed viewport replacement in packages/mobile-bridge/src/inject.ts:166 drops the existing app's viewport-fit=cover and interactive-widget=resizes-content. Preserve these directives when testing a revision. This is a diff-level risk, not a demonstrated device failure. Its JavaScript tests cannot by themselves verify native pinch or double-tap suppression. Verdict: not runtime-verified; no endorsement of the proposed native patch.
8. Related issues
- #7989: another open report for the same native-shell zoom topic, classified Bug / Medium / Low / mobile. No issue was closed or reclassified as a duplicate in this run.
- #3770: browser composer focus-zoom topic. A native-only fix must not silently impose a browser-wide no-zoom policy.
9. Verification
The same agent repeated the diagnostic in a second new clean trusted checkout (verify/) at the recorded SHA, with a separate frozen install. No app process was needed, so there were no ports or data directories to reuse. The probe again installed the real bridge, printed the same unconstrained viewport, and exited 1. The two runs have byte-identical probe output. Raw evidence is retained locally, not published as separate scripts or logs, in accordance with the reports repository policy.
The second checkout also passed all 396 existing mobile and bridge tests; the later first-checkout test run reused Turbo cache. verified: true in the publication summary means this limited partial finding was repeated, not that the native visual symptom was verified. The report corrects the initial viewport attribution from marketing web to the app shell. This check is not independent review.
10. Appendix
Environment, build, and test results · Repeatable commands
Trusted base: 35a03bbbb3f4d8dc814c1a152db5a463102b4250 pnpm install --frozen-lockfile --prefer-offline: exit 0 in both clean checkouts pnpm exec turbo run test --filter=@bb/mobile-bridge --filter=@bb/mobile: exit 0 in both checkouts @bb/mobile-bridge: 3 test files passed; 40 tests passed @bb/mobile: 49 test files passed; 356 tests passed The verification checkout executed both suites; the later base run reused Turbo's test cache. pnpm exec turbo run build: exit 1 on unchanged base bb-plugin-github:build: [ERROR] "@get-bb/plugin-sdk/process" is installed for this plugin but its dist is not built bb-plugin-github:build: [ERROR] "@get-bb/plugin-sdk/host" is installed for this plugin but its dist is not built This unrelated build-preparation failure was not modified or treated as reproduction evidence. Linux; node v22.19.0; pnpm 9.15.0; no xcrun, xcodebuild, or adb available No application instance, provider session, listening port, paired server, or runtime data directory used.
Trust boundary: issue text, comments, and linked PR material were treated as untrusted claims. No issue-provided instruction, command, external link, script, patch, branch, or test was executed. Only trusted main, installed lockfile dependencies, and this locally authored report probe were used. No credentials, private application data, or home paths are included.