Skip to content

Commit 9171bed

Browse files
fix(app-shell): on a phone, the bottom bar pages scroll their last row out from under the bar (#37252)
Fixes #36792 Clause-②: no Metadata-protocol: none ## 维护者速读 - 手机用户在应用首页和审批页把长页面滚到底时,最后一行现在会完整停在底部导航栏上方;以前首页最底下约 33 像素被导航栏挡住、滚不出来(审批页末行压在导航栏边上约 0.67 像素)。 - 修的是手机底部导航栏下首页和审批两页的滚动留白,替手机端用户解决末行点不到、看不全的问题;通知页本来就在自己的列表里滚动,保持不变。 - 出错时最多是这两页底部多一段空白或页面布局变化;只是一处样式改动,可直接撤回。 - 无 ## What changes While the phone bottom bar is drawn (the app home, the inbox list and the approvals inbox, below 768 px), the console inset, the element that scrolls, keeps the bar's height as end padding. A scroll container's end padding only follows its in-flow content. The route slot (`data-testid="console-route"`) was a fixed `h-full` box. A page taller than the inset (the phone app home with a long menu, or a long approvals inbox) overflowed that slot. The scroll then ended at the page's own bottom, and its last rows stayed under the bar. `ConsoleLayout` now grows the route slot with its page on the bar's home and approvals pages. The slot is a one-track grid (`grid h-auto min-h-full grid-cols-[minmax(0,1fr)]`), so: - it is never shorter than the inset, and a page root's `h-full` still resolves against its stretched row. A short page or the empty state fills the inset as before; - it grows past the inset with a taller page. The slot is the inset's in-flow content, so the inset's existing end padding lands after the page's last row; - `minmax(0,1fr)` keeps a wide page from widening the slot. The inset's padding class is unchanged. The inbox list keeps the fixed slot. It is an object list page: it bounds itself and scrolls its rows in its own box (objectui#12463). A growing slot would unbind a long list. I measured this: on a long object list, a growing slot turned the list's own scroller into a page scroll. Every route without the bar, and every route from 768 px up, also keeps the fixed slot. Responsibility: - Whose code: the platform's own `@object-ui/app-shell` `ConsoleLayout`. - Existing platform path: none. - Who reaches it: phone users on a long natural-height page (the phone app home, the approvals inbox). Read first: 1. `ui/packages/app-shell/src/layout/ConsoleLayout.tsx`, the `phoneSlotGrows` flag and the slot's `cn(...)`. This is the risky hunk: it decides which bar routes grow. 2. `ui/packages/app-shell/src/layout/__tests__/ConsoleLayout.phoneRecordOneBar-28483.test.tsx`, the new top-level `describe` for objectstack#36792. Two-minute check: open the showcase app home in iPhone 13 emulation and scroll to the end. The menu's last row ends above the bottom bar's top edge, and the bar no longer covers it. ## Tests - The new top-level `describe('a phone bar page's end inset scrolls with its content (objectstack#36792)')` sits in the existing ConsoleLayout phone harness. It has three cases: - At 375 px, the app root and the approvals inbox grow the slot (grid, `min-h-full`, `h-auto`, no `h-full`, one `minmax(0,1fr)` track) inside the padded `overflow-y-auto` scroller. - The inbox list keeps the fixed slot. - CONTROL: a list, a record page, a page route at 375 px, and bar routes at 768 / 1440 px all keep the fixed slot. - The existing objectstack#35882 pins assert the end padding on the slot's parent. They are unchanged and still pass: the padding stays on the scroller. - `pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/layout/__tests__/ConsoleLayout.phoneRecordOneBar-28483.test.tsx`: 18/18 passed (15 existing + 3 new). - `pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/layout/`: 164 files, 1424 tests passed. - `pnpm --filter @object-ui/app-shell run type-check` (both tsc legs, after building the closure `@object-ui/app-shell^...`): exit 0. Ablation (one-off, `scripts/ablation-replace.mjs`): the fix commit is on HEAD; the mutation reverts the flag to `const phoneSlotGrows = false && ...`. - Anchor x1 to x0, blob 2ae1531 to f5e6056d. - The harness file went red: 1 failed / 17 passed, and the failing case is the home-and-approvals grow case. - Restored: blob 2ae1531 == HEAD, and `git diff HEAD` is empty. ## Acceptance notes - The page root's own empty bottom padding (`pb-6` on the phone app home) ends 1 px under the bar's top edge after the fix. The cause is that the bar is 57 px tall (h-12, 4 px padding each side, plus its 1 px top border), while the inset reserves 3.5rem (56 px). No content sits there: the menu's last row ends 23 px above the bar. The same 1 px applies to every bounded page on the bar routes today. Noted, not filed. ## Verification Browser reading: the showcase stack (own `--fresh` backend, the Console's Vite dev server reading `ui/` source), Chromium with Playwright `devices['iPhone 13']` (viewport 390 x 664). On each route I scrolled the inset to its end and read the rects. The bar spans 607 to 664 in every reading. | Route | Reading | Before (origin/main a03c3d4) | After (this branch) | |---|---|---|---| | App home | scrollHeight / clientHeight | 3037 / 616 (equals the page height, no end padding) | 3093 / 616 (page + 56) | | App home | menu box bottom | 640 (33 px under the bar top) | 584 (23 px above) | | App home | page box bottom | 664 | 608 | | Approvals inbox | scrollHeight | 753 | 809 | | Approvals inbox | lowest drawn element bottom | 607.67 (under the bar top) | 551.67 | | Inbox list (control) | scrollHeight / footer "3 records" bottom | 616 / 600 | 616 / 600 (unchanged) | | Account list, no bar (control) | scrollHeight / slot height | 616 / 616 | 616 / 616 (unchanged) | <details><summary>Gates (local, at b589350)</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 38 commands. All 38 were run, and each exited 0 (exit captured per command before any pipe). The two named in the dispatch's ui-scripts family: - `pnpm --dir ui exec vitest run --maxWorkers=2 scripts/`: VERDICT command-exit 0. - `pnpm check:type-check-debt`: exit 0, "surplus: none". `--ran` reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN. `node scripts/pm/overlap-check.mjs --branch=origin/claude/issue-36792-phone-bottom-inset-scroll` before each push: VERDICT clean exit 0. The CI-owned runs (Lint & Repo Gates, Test UI, Type Check UI, Build & E2E UI, Live E2E UI and the rest) are this PR's check-runs. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D)_ <!-- signed: repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fc21674 commit 9171bed

3 files changed

Lines changed: 89 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(app-shell): on a phone, a long page on the bottom bar's home or approvals page scrolls its last row out from under the bar
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
While the phone's bottom bar is drawn, the console inset keeps the bar's height as end padding. A scroll container's end padding only follows its in-flow content, and the route slot was a fixed `h-full` box: a page taller than the inset (the phone app home with a long menu, a long approvals inbox) overflowed the slot, the scroll ended at the page's own bottom, and its last rows stayed under the bar. On the bar's home and approvals pages the route slot now grows with its page, never shorter than the inset, so scrolling to the end brings the last row above the bar and the safe area. A short page or an empty state still fills the inset as before. The inbox list, an object list that bounds itself and scrolls its rows in its own box, keeps the fixed slot, and so does every route without the bar and every route from 768 px up.

‎ui/packages/app-shell/src/layout/ConsoleLayout.tsx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { DraftPreviewBar } from '../preview/DraftPreviewBar.js';
2323
import { UnpublishedAppBar } from '../preview/UnpublishedAppBar.js';
2424
import { ConsoleNotificationBanners } from './ConsoleNotificationBanners.js';
2525
import { UnifiedSidebar } from './UnifiedSidebar.js';
26-
import { PhoneAppNavBar, isPhoneTabRoute } from './PhoneAppNavBar.js';
26+
import { PhoneAppNavBar, isPhoneTabRoute, phoneTabOf } from './PhoneAppNavBar.js';
2727
import { PhoneAppHomeSlotProvider } from './PhoneAppHome.js';
2828
import { PhonePageBarProvider } from './PhonePageBar.js';
2929
import { SidebarDocsNavSlotProvider } from './sidebarDocsNavSlot.js';
@@ -195,6 +195,15 @@ export function ConsoleLayout({
195195
// the top left goes back. The route slot leaves the bar's height free at its
196196
// end.
197197
const phoneNavBar = phone && isPhoneTabRoute(location.pathname);
198+
// objectstack#36792 — the inset's end padding only scrolls when it follows
199+
// in-flow content: a page taller than an `h-full` route slot overflows the
200+
// slot, and the scroll ends at the page's bottom, under the bar. So on the
201+
// bar's home and approvals pages the slot grows with its page (at least the
202+
// inset's height, so a short page or an empty state still fills it) and the
203+
// padding ends the scroll above the bar. The inbox list keeps the fixed slot:
204+
// it is an object list page, which bounds itself and scrolls its rows in its
205+
// own box (objectui#12463), and a growing slot would unbound a long one.
206+
const phoneSlotGrows = phoneNavBar && phoneTabOf(location.pathname) !== 'notifications';
198207
// objectstack#35424 — a docs page has one navigation, the docs' own (the
199208
// app's books and a way back to the app), so the app's menu is not drawn
200209
// there. objectstack#37150 (ruling 7142354097 on objectstack#36107) — from
@@ -393,7 +402,14 @@ export function ConsoleLayout({
393402
ref={mainContentRef}
394403
tabIndex={-1}
395404
data-testid="console-route"
396-
className="h-full lg:min-h-0 focus:outline-none"
405+
className={cn(
406+
'h-full lg:min-h-0 focus:outline-none',
407+
// objectstack#36792 — a one-track grid: its row stretches to the
408+
// `min-h-full` floor, so a page's `h-full` root still resolves
409+
// against it, and grows past it with a taller page. The track's
410+
// `minmax(0,1fr)` keeps a wide page from widening the slot.
411+
phoneSlotGrows && 'grid h-auto min-h-full grid-cols-[minmax(0,1fr)]',
412+
)}
397413
>
398414
<ShellSidebarExpandFallback />
399415
{children}

‎ui/packages/app-shell/src/layout/__tests__/ConsoleLayout.phoneRecordOneBar-28483.test.tsx‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,67 @@ describe('the phone bottom bar is drawn on its three pages only (objectstack#358
228228
});
229229
});
230230

231+
/**
232+
* objectstack#36792 — a scroll container's end padding scrolls only after its
233+
* in-flow content. While the bar is drawn the inset (the element that scrolls)
234+
* keeps the bar's height as end padding, so on the bar's home and approvals
235+
* pages, which grow with their content, the route slot grows with its page
236+
* (a one-track grid at least the inset's height): the slot is the inset's
237+
* in-flow content and the padding lands after the page's last row. A fixed
238+
* `h-full` slot there let a tall page overflow it, and the scroll ended at the
239+
* page's bottom, under the bar. The inbox list, an object list page that
240+
* bounds itself, keeps the fixed slot; so does every route without the bar.
241+
*/
242+
describe('a phone bar page\'s end inset scrolls with its content (objectstack#36792)', () => {
243+
const slot = () => screen.getByTestId('console-route');
244+
const slotGrows = () => {
245+
const c = slot().classList;
246+
return c.contains('grid') && c.contains('min-h-full') && c.contains('h-auto') && !c.contains('h-full');
247+
};
248+
const slotFixed = () => {
249+
const c = slot().classList;
250+
return c.contains('h-full') && !c.contains('min-h-full') && !c.contains('grid');
251+
};
252+
const scrollerPadsEnd = () => {
253+
const scroller = slot().parentElement!;
254+
return (
255+
scroller.classList.contains('overflow-y-auto') &&
256+
scroller.classList.contains('!pb-[calc(3.5rem+env(safe-area-inset-bottom))]')
257+
);
258+
};
259+
260+
it('at 375 px the app home and the approvals inbox grow the slot inside the padded scroller', () => {
261+
for (const path of ['/apps/crm', '/apps/crm/', '/apps/crm/system/approvals']) {
262+
mountAt(path, 375);
263+
expect(slotGrows(), path).toBe(true);
264+
expect(scrollerPadsEnd(), path).toBe(true);
265+
// The track never widens the slot past the inset.
266+
expect(slot().classList.contains('grid-cols-[minmax(0,1fr)]'), path).toBe(true);
267+
cleanup();
268+
}
269+
});
270+
271+
it('at 375 px the inbox list keeps the fixed slot: it bounds itself above the bar', () => {
272+
mountAt('/apps/crm/sys_inbox_message', 375);
273+
expect(slotFixed()).toBe(true);
274+
expect(scrollerPadsEnd()).toBe(true);
275+
});
276+
277+
it('CONTROL — routes without the bar, and every route from 768 px up, keep the fixed slot', () => {
278+
for (const [path, width] of [
279+
['/apps/crm/crm_lead', 375],
280+
[RECORD, 375],
281+
['/apps/crm/page/home', 375],
282+
['/apps/crm', 768],
283+
['/apps/crm/system/approvals', 1440],
284+
] as const) {
285+
mountAt(path, width);
286+
expect(slotFixed(), `${width} px ${path}`).toBe(true);
287+
cleanup();
288+
}
289+
});
290+
});
291+
231292
describe('an app\'s docs pages draw in the app shell from 768 px up (objectstack#37150), and no app menu (objectstack#35424)', () => {
232293
const sidebar = () => screen.queryByTestId('sidebar-stub');
233294
const DOCS_PATHS = [

0 commit comments

Comments
 (0)