#6549 · Standalone shell height investigation
Trusted base: 3bacfac9ed69d42392076e5b3da2815bec822cd8
PARTIALLY REPRODUCED · root-cause confidence: medium for the conditional mechanism; low for attribution to the reported device.
1. TL;DR
A direct test of the production viewport hook shows that a shorter visual viewport can shrink an otherwise full-height standalone shell without any keyboard focus. With the 852/793 geometry already documented in the repository's standalone CSS, the hook writes a 793px inline height and publishes that height to body-portaled panels. That creates a conditional 59px loss relative to the supplied full-height containing block. This is not a reproduction of the reported foldable iPhone's actual viewport values or its approximately 50pt band. No production fix is justified until the device's viewport and safe-area values distinguish this mechanism from ordinary inset padding.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| The actual foldable device loses about 50pt below the shell. | Unverified | No device, Safari simulator, runtime measurements, or accessible local screenshots; only a conditional unit reproduction. |
| A full-height standalone shell can be shortened again. | Verified conditionally | Both clean checkouts: containing block 852, visual viewport 793, shell and inherited height 793px, no keyboard focus. The input geometry comes from trusted app.css, not device measurement. |
| Settings scroll content stops above shell padding. | Source-supported; not rendered | AppLayout applies bottom safe-area padding around its main child; SettingsView renders PageShell's nested scroll viewport. Actual inset value and clipping were not measured. |
| The bottom safe area is applied twice. | Not established | The tested shrink occurs without any CSS inset. Padding and viewport correction are separate mechanisms. |
| The top should have artificial spacing when its safe area is zero. | Not established | The code uses the platform top inset. Symmetric decorative spacing is a product choice, not a demonstrated defect. |
3. Environment
- Public get-bb/bb, trusted origin/main at the full commit above; Linux x86_64, Node v22.19.0, pnpm 9.15.0.
- Two new detached worktrees named
baseandverify, created at the same recorded commit. Production files were unchanged; the diagnostic test was the sole untracked source file. - First checkout: frozen install and complete Turbo build passed (72 tasks). Second checkout: fresh frozen install and targeted app/server/daemon build passed (8 cached tasks).
- An isolated fresh first-checkout development instance started on app 11040, server 19040, daemon 27040. Its data was created for this investigation only. No user runtime data or provider turn was used. The unit reproductions do not require ports or stored data; a second live instance was unnecessary.
- Browser Automation open failed with:
Install Chrome/Chromium on this host or link its executable at the plugin data runtime/chrome path.The temporary Chrome 142.0.7444.61 binary then failed to loadlibglib-2.0.so.0. No browser session existed and no screenshot claim is made.
4. Minimal reproduction
This is a conditional hook-level regression probe, not an assertion that these are the foldable phone's values. The full-height/short-viewport inputs are documented in the trusted source at app.css:15–23.
- Clone trusted main and pin the recorded commit:
git clone https://github.com/get-bb/bb.git bb-repro cd bb-repro git checkout --detach 3bacfac9ed69d42392076e5b3da2815bec822cd8 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build
- Copy the complete inline diagnostic test below into
apps/app/src/components/layout/standalone-height.test.tsx. - Run:
pnpm exec turbo run test --filter=@bb/app -- src/components/layout/standalone-height.test.tsx
Expected by the conditional standalone invariant: absent a keyboard, leave the shell height to the existing full-screen CSS. Actual output, identical in both clean runs:
{"containingBlock":852,"visualViewport":793,"shellHeight":"793px","inheritedShellHeight":"793px","keyboardFocused":false}
AssertionError: expected '793px' to be ''
Test Files 1 failed (1)
Tests 1 failed | 1 passed (2)
The equal-height control passes. The failure establishes that this hook does not distinguish standalone viewport under-reporting from a legitimately occluded visual viewport. It does not establish which condition occurred on the phone.
Complete diagnostic test
// @vitest-environment jsdom
import { cleanup, render } from "@testing-library/react";
import { useState } from "react";
import { afterEach, expect, it, vi } from "vitest";
import { useMobileVisualViewportHeight } from "./useMobileVisualViewportHeight";
function Shell() {
const [shell, setShell] = useState<HTMLDivElement | null>(null);
useMobileVisualViewportHeight(shell, true);
return <div ref={setShell} data-testid="shell" />;
}
afterEach(() => {
cleanup();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
function installViewport(height: number) {
const viewport = Object.assign(new EventTarget(), {
height,
width: 393,
offsetTop: 0,
offsetLeft: 0,
pageTop: 0,
pageLeft: 0,
scale: 1,
});
vi.stubGlobal("visualViewport", viewport);
vi.spyOn(document.body, "clientHeight", "get").mockReturnValue(852);
vi.stubGlobal("matchMedia", (query: string) => ({
matches: query === "(display-mode: standalone)",
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
}));
}
it("leaves the shell full height when viewport and containing block agree", () => {
installViewport(852);
const { getByTestId } = render(<Shell />);
expect(getByTestId("shell").style.height).toBe("");
expect(document.body.style.getPropertyValue("--bb-shell-height")).toBe("");
});
it("preserves a standalone full-screen shell without keyboard focus", () => {
installViewport(793);
const { getByTestId } = render(<Shell />);
const shell = getByTestId("shell");
console.log(JSON.stringify({
containingBlock: document.body.clientHeight,
visualViewport: window.visualViewport?.height,
shellHeight: shell.style.height,
inheritedShellHeight: document.body.style.getPropertyValue("--bb-shell-height"),
keyboardFocused: document.activeElement !== document.body,
}));
expect(shell.style.height).toBe("");
});
5. Root cause and limits
The standalone CSS sets the root shell to 100lvh to avoid a documented iOS short viewport. However, the visual-viewport hook compares the body's full containing-block height with visualViewport.height, and publishes the latter whenever they differ by more than one pixel. This path requires neither keyboard focus nor standalone detection.
const visualViewportHeight = Math.round(visualViewport.height);
shellContainingBlockHeight = document.body.clientHeight;
...
shell.style.height = `${visualViewportHeight}px`;
viewportStyleRoot.style.setProperty("--bb-shell-height", `${visualViewportHeight}px`);
AppLayout invokes the hook for both compact and wide views. The inline shell height and inherited body variable can therefore counteract the full-screen intent of the standalone CSS. If the platform supplies a shorter visual viewport while still displaying the full standalone screen, a bottom gap follows. Whether that premise holds for this phone is unknown.
Separately, the content shell owns the safe-area padding outside main; SettingsView uses PageShell’s nested overflow-y-auto viewport. Moving that padding is not proved safe: it would affect other routes, keyboard behavior, and genuine home-indicator protection. Header top padding directly follows the platform inset; a zero inset alone does not prove a bug.
6. Proposed next test; no safe fix yet
On the affected device, record innerHeight, visualViewport.height/offsetTop/scale, document.body.clientHeight, screen.height, standalone display-mode, computed --bb-shell-height, the content shell's bounding rectangle, and resolved top/right/bottom/left safe-area padding, with the keyboard dismissed. Repeat folded/unfolded and Settings/thread. Check whether the reported empty band is outside the shell or inside padding before changing CSS.
If the short-viewport premise is confirmed, preserve standalone full-height behavior without breaking keyboard, zoom, or embedded-browser correction. The existing hook suite explicitly depends on mismatch correction, so indiscriminately ignoring mismatches would be unsafe. No fix branch or PR was created: the actual device bug was not reproduced and no passing before/after device-appropriate regression proof exists. An open-PR search and issue cross-reference inspection found no linked open PR at investigation time.
7. Verification
The same agent repeated the test in a second newly created detached worktree at 3bacfac9ed69d42392076e5b3da2815bec822cd8; this is a clean rerun, not independent verification. The tracked production diff against origin/main was empty. After a separate frozen install and targeted build, the identical command again returned exit 1, with the equal-height control passing and the short-viewport invariant failing with 793px. No production code was modified between runs.
Report correction during verification: the verdict is limited to PARTIALLY REPRODUCED; it does not assert the phone's 50pt band, duplicate insets, visual clipping, or a confirmed device root cause. Existing viewport and sidebar-safe-area tests pass: 18 tests across 2 files.
First clean run output:
{"containingBlock":852,"visualViewport":793,"shellHeight":"793px","inheritedShellHeight":"793px","keyboardFocused":false}
✓ leaves the shell full height when viewport and containing block agree 17ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL |@bb/app:isolated| src/components/layout/standalone-height.test.tsx > preserves a standalone full-screen shell without keyboard focus
AssertionError: expected '793px' to be '' // Object.is equality
- Expected
+ Received
+ 793px
Test Files 1 failed (1)
Tests 1 failed | 1 passed (2)
Start at 09:49:31
Duration 2.71s (transform 1.71s, setup 1.69s, import 245ms, tests 27ms, environment 563ms)
Second clean run output:
{"containingBlock":852,"visualViewport":793,"shellHeight":"793px","inheritedShellHeight":"793px","keyboardFocused":false}
✓ leaves the shell full height when viewport and containing block agree 20ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL |@bb/app:isolated| src/components/layout/standalone-height.test.tsx > preserves a standalone full-screen shell without keyboard focus
AssertionError: expected '793px' to be '' // Object.is equality
- Expected
+ Received
+ 793px
Test Files 1 failed (1)
Tests 1 failed | 1 passed (2)
Start at 09:49:41
Duration 2.79s (transform 1.83s, setup 1.77s, import 244ms, tests 32ms, environment 557ms)
Existing tests output:
✓ |@bb/app:isolated| src/components/layout/useMobileVisualViewportHeight.test.tsx (14 tests) 695ms
✓ |@bb/app:isolated| src/components/ui/sidebar-safe-area.test.tsx (4 tests) 155ms
Test Files 2 passed (2)
Tests 18 passed (18)
Start at 09:50:27
Duration 8.19s (transform 10.22s, setup 3.23s, import 7.81s, tests 851ms, environment 1.37s)
Each permalink above was checked against unchanged production files at the recorded commit. The isolated development instance was stopped after investigation and its temporary data removed.
8. Related issues
The issue distinguishes a horizontal sidebar inset problem and an earlier standalone shell-height report. Neither was treated as evidence that this phone has the same cause; the documented standalone geometry in trusted app.css is the basis of this experiment.
9. Appendix
pnpm exec turbo run build --filter=@bb/app --filter=@bb/server --filter=@bb/host-daemon pnpm exec turbo run test --filter=@bb/app -- src/components/layout/useMobileVisualViewportHeight.test.tsx src/components/ui/sidebar-safe-area.test.tsx Result: 2 files passed; 18 tests passed.
Issue body and comments were treated as untrusted claims. No issue instructions, supplied code, attachment URLs, scripts, patches, or linked branches were executed. No external PR branch was checked out. Only the trusted base and this locally authored diagnostic were run. Public artifacts contain no runtime database, credentials, user home path, or live-instance logs.
AGENT GENERATED