Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/36792-phone-bar-end-inset-scrolls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@object-ui/app-shell': patch
---

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

Clause-②: no
Metadata-protocol: none

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.
20 changes: 18 additions & 2 deletions ui/packages/app-shell/src/layout/ConsoleLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { DraftPreviewBar } from '../preview/DraftPreviewBar.js';
import { UnpublishedAppBar } from '../preview/UnpublishedAppBar.js';
import { ConsoleNotificationBanners } from './ConsoleNotificationBanners.js';
import { UnifiedSidebar } from './UnifiedSidebar.js';
import { PhoneAppNavBar, isPhoneTabRoute } from './PhoneAppNavBar.js';
import { PhoneAppNavBar, isPhoneTabRoute, phoneTabOf } from './PhoneAppNavBar.js';
import { PhoneAppHomeSlotProvider } from './PhoneAppHome.js';
import { PhonePageBarProvider } from './PhonePageBar.js';
import { SidebarDocsNavSlotProvider } from './sidebarDocsNavSlot.js';
Expand Down Expand Up @@ -195,6 +195,15 @@ export function ConsoleLayout({
// the top left goes back. The route slot leaves the bar's height free at its
// end.
const phoneNavBar = phone && isPhoneTabRoute(location.pathname);
// objectstack#36792 — the inset's end padding only scrolls when it follows
// in-flow content: a page taller than an `h-full` route slot overflows the
// slot, and the scroll ends at the page's bottom, under the bar. So on the
// bar's home and approvals pages the slot grows with its page (at least the
// inset's height, so a short page or an empty state still fills it) and the
// padding ends the scroll above the bar. The inbox list keeps the fixed slot:
// it is an object list page, which bounds itself and scrolls its rows in its
// own box (objectui#12463), and a growing slot would unbound a long one.
const phoneSlotGrows = phoneNavBar && phoneTabOf(location.pathname) !== 'notifications';
// objectstack#35424 — a docs page has one navigation, the docs' own (the
// app's books and a way back to the app), so the app's menu is not drawn
// there. objectstack#37150 (ruling 7142354097 on objectstack#36107) — from
Expand Down Expand Up @@ -393,7 +402,14 @@ export function ConsoleLayout({
ref={mainContentRef}
tabIndex={-1}
data-testid="console-route"
className="h-full lg:min-h-0 focus:outline-none"
className={cn(
'h-full lg:min-h-0 focus:outline-none',
// objectstack#36792 — a one-track grid: its row stretches to the
// `min-h-full` floor, so a page's `h-full` root still resolves
// against it, and grows past it with a taller page. The track's
// `minmax(0,1fr)` keeps a wide page from widening the slot.
phoneSlotGrows && 'grid h-auto min-h-full grid-cols-[minmax(0,1fr)]',
)}
>
<ShellSidebarExpandFallback />
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,67 @@ describe('the phone bottom bar is drawn on its three pages only (objectstack#358
});
});

/**
* objectstack#36792 — a scroll container's end padding scrolls only after its
* in-flow content. While the bar is drawn the inset (the element that scrolls)
* keeps the bar's height as end padding, so on the bar's home and approvals
* pages, which grow with their content, the route slot grows with its page
* (a one-track grid at least the inset's height): the slot is the inset's
* in-flow content and the padding lands after the page's last row. A fixed
* `h-full` slot there let a tall page overflow it, and the scroll ended at the
* page's bottom, under the bar. The inbox list, an object list page that
* bounds itself, keeps the fixed slot; so does every route without the bar.
*/
describe('a phone bar page\'s end inset scrolls with its content (objectstack#36792)', () => {
const slot = () => screen.getByTestId('console-route');
const slotGrows = () => {
const c = slot().classList;
return c.contains('grid') && c.contains('min-h-full') && c.contains('h-auto') && !c.contains('h-full');
};
const slotFixed = () => {
const c = slot().classList;
return c.contains('h-full') && !c.contains('min-h-full') && !c.contains('grid');
};
const scrollerPadsEnd = () => {
const scroller = slot().parentElement!;
return (
scroller.classList.contains('overflow-y-auto') &&
scroller.classList.contains('!pb-[calc(3.5rem+env(safe-area-inset-bottom))]')
);
};

it('at 375 px the app home and the approvals inbox grow the slot inside the padded scroller', () => {
for (const path of ['/apps/crm', '/apps/crm/', '/apps/crm/system/approvals']) {
mountAt(path, 375);
expect(slotGrows(), path).toBe(true);
expect(scrollerPadsEnd(), path).toBe(true);
// The track never widens the slot past the inset.
expect(slot().classList.contains('grid-cols-[minmax(0,1fr)]'), path).toBe(true);
cleanup();
}
});

it('at 375 px the inbox list keeps the fixed slot: it bounds itself above the bar', () => {
mountAt('/apps/crm/sys_inbox_message', 375);
expect(slotFixed()).toBe(true);
expect(scrollerPadsEnd()).toBe(true);
});

it('CONTROL — routes without the bar, and every route from 768 px up, keep the fixed slot', () => {
for (const [path, width] of [
['/apps/crm/crm_lead', 375],
[RECORD, 375],
['/apps/crm/page/home', 375],
['/apps/crm', 768],
['/apps/crm/system/approvals', 1440],
] as const) {
mountAt(path, width);
expect(slotFixed(), `${width} px ${path}`).toBe(true);
cleanup();
}
});
});

describe('an app\'s docs pages draw in the app shell from 768 px up (objectstack#37150), and no app menu (objectstack#35424)', () => {
const sidebar = () => screen.queryByTestId('sidebar-stub');
const DOCS_PATHS = [
Expand Down
Loading