From 8090e88fb7bcf956bb57f2ff49cde64a8dfc52cd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 13:42:34 +0000 Subject: [PATCH 1/3] fix(app-shell): a full-height console page gives the in-place banners their height back Claude-Session: https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri Co-authored-by: Claude --- .../37528-impersonation-banner-height.md | 12 ++ .../app-shell/src/console/ai/AiChatPage.tsx | 3 +- .../app-shell/src/console/home/HomeLayout.tsx | 3 +- .../organizations/OrganizationsLayout.tsx | 3 +- .../manage/OrganizationLayout.tsx | 3 +- ...romeBannerHost.bannerHeight-37528.test.tsx | 111 ++++++++++++++++++ .../app-shell/src/layout/chromeBannerHost.tsx | 77 +++++++++++- .../studio-design/StudioDesignSurface.tsx | 3 +- ui/packages/layout/src/AppShell.tsx | 4 +- 9 files changed, 211 insertions(+), 8 deletions(-) create mode 100644 .changeset/37528-impersonation-banner-height.md create mode 100644 ui/packages/app-shell/src/layout/__tests__/chromeBannerHost.bannerHeight-37528.test.tsx diff --git a/.changeset/37528-impersonation-banner-height.md b/.changeset/37528-impersonation-banner-height.md new file mode 100644 index 00000000000..0aee7d20b68 --- /dev/null +++ b/.changeset/37528-impersonation-banner-height.md @@ -0,0 +1,12 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/layout': patch +--- + +fix(app-shell): a full-height console page gives the impersonation banner its height back + +Clause-②: no +Metadata-protocol: none + +- While an administrator impersonates a user, the console draws its banner above the page. Where it is drawn in place (every page on a phone, and Studio, Home and the organization pages on a desktop) the page below still took the whole viewport, so the document was taller than the window by the banner's height: a list's footer and bulk action bar sat below the fold and the page gained a second scrollbar. The same held for the read-rate and storage banners beside it. +- The banners drawn in place now publish their height as the CSS custom property `--os-chrome-banners` on the document root, and the console's full-height shells take the viewport less it: `AppShell` (`@object-ui/layout`), Studio, Home, the AI chat page and the organization layouts. While no banner is drawn in place, and anywhere outside the console, the property is unset and every shell keeps its viewport height. Inside an app on a desktop the banners are drawn into the content area, as before, and publish nothing. diff --git a/ui/packages/app-shell/src/console/ai/AiChatPage.tsx b/ui/packages/app-shell/src/console/ai/AiChatPage.tsx index 3ec954cd3e3..2ec33050148 100644 --- a/ui/packages/app-shell/src/console/ai/AiChatPage.tsx +++ b/ui/packages/app-shell/src/console/ai/AiChatPage.tsx @@ -21,6 +21,7 @@ import { useServedAppLabel } from '../../hooks/useServedAppLabel.js'; import { toast } from 'sonner'; import { Package as PackageIcon, Sparkles as SparklesIcon } from 'lucide-react'; import { useAdapter } from '../../providers/AdapterProvider.js'; +import { CONSOLE_FULL_HEIGHT } from '../../layout/chromeBannerHost.js'; import { isPlatformBuiltinApp } from '../../utils/platformApp.js'; import { useMetadata } from '../../providers/MetadataProvider.js'; import { formatPublishFailures, type PublishFailure } from '../../views/studio-design/metadataError.js'; @@ -1567,7 +1568,7 @@ export function AiChatPage({ apiBase: apiBaseProp, defaultAgent: defaultAgentPro ); return ( -
+
{/* Mobile: open the chats list as a sheet. The DESKTOP collapse toggle is NOT in the top nav — it lives at the bottom-left of the chats diff --git a/ui/packages/app-shell/src/console/home/HomeLayout.tsx b/ui/packages/app-shell/src/console/home/HomeLayout.tsx index 9a447ca08bb..3e5113a58aa 100644 --- a/ui/packages/app-shell/src/console/home/HomeLayout.tsx +++ b/ui/packages/app-shell/src/console/home/HomeLayout.tsx @@ -51,6 +51,7 @@ import React, { useEffect, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { cn } from '@object-ui/components'; import { useNavigationContext } from '../../context/NavigationContext.js'; +import { CONSOLE_FULL_HEIGHT } from '../../layout/chromeBannerHost.js'; import { CommandPaletteProvider, useCommandPalette } from '../../context/CommandPaletteProvider.js'; import { CommandPalette } from '../../chrome/CommandPalette.js'; import { AppHeader } from '../../layout/AppHeader.js'; @@ -182,7 +183,7 @@ export function HomeLayout({ children, variant = 'home' }: HomeLayoutProps) { {/* With the drawer's rail open the page is bounded to the window, so the rail spans it and the page scrolls in its own box beside it. */}
{/* The provider wraps the bar and the palette only: the page below diff --git a/ui/packages/app-shell/src/console/organizations/OrganizationsLayout.tsx b/ui/packages/app-shell/src/console/organizations/OrganizationsLayout.tsx index 0ad0110dd02..89bbb59ea83 100644 --- a/ui/packages/app-shell/src/console/organizations/OrganizationsLayout.tsx +++ b/ui/packages/app-shell/src/console/organizations/OrganizationsLayout.tsx @@ -12,6 +12,7 @@ import React, { useEffect } from 'react'; import { useNavigationContext } from '../../context/NavigationContext.js'; import { AppHeader } from '../../layout/AppHeader.js'; import { CONSOLE_TOP_BAR } from '../../layout/consoleTopBar.js'; +import { CONSOLE_FULL_HEIGHT } from '../../layout/chromeBannerHost.js'; interface OrganizationsLayoutProps { children: React.ReactNode; @@ -25,7 +26,7 @@ export function OrganizationsLayout({ children }: OrganizationsLayoutProps) { }, [setContext]); return ( -
+
diff --git a/ui/packages/app-shell/src/console/organizations/manage/OrganizationLayout.tsx b/ui/packages/app-shell/src/console/organizations/manage/OrganizationLayout.tsx index 2a9bec4bf8b..4b95d466242 100644 --- a/ui/packages/app-shell/src/console/organizations/manage/OrganizationLayout.tsx +++ b/ui/packages/app-shell/src/console/organizations/manage/OrganizationLayout.tsx @@ -15,6 +15,7 @@ import { Button } from '@object-ui/components'; import { useNavigationContext } from '../../../context/NavigationContext.js'; import { AppHeader } from '../../../layout/AppHeader.js'; import { CONSOLE_TOP_BAR } from '../../../layout/consoleTopBar.js'; +import { CONSOLE_FULL_HEIGHT } from '../../../layout/chromeBannerHost.js'; export function OrganizationLayout() { const { t } = useObjectTranslation(); @@ -79,7 +80,7 @@ export function OrganizationLayout() { ]; return ( -
+
diff --git a/ui/packages/app-shell/src/layout/__tests__/chromeBannerHost.bannerHeight-37528.test.tsx b/ui/packages/app-shell/src/layout/__tests__/chromeBannerHost.bannerHeight-37528.test.tsx new file mode 100644 index 00000000000..17cb43996e0 --- /dev/null +++ b/ui/packages/app-shell/src/layout/__tests__/chromeBannerHost.bannerHeight-37528.test.tsx @@ -0,0 +1,111 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The banners drawn in place, above the console's routes, publish their + * height as `--os-chrome-banners` so a full-height page can give it back + * (objectstack#37528). Drawn into an app layout's host they publish nothing: + * the host sits inside the content area the page already sizes. + */ +import { describe, it, expect, afterEach, beforeEach, vi } from 'vitest'; +import { render, cleanup, act } from '@testing-library/react'; +import * as React from 'react'; +import { + CHROME_BANNERS_HEIGHT_VAR, + CONSOLE_FULL_HEIGHT, + ChromeBannerHost, + ChromeBannerSlot, +} from '../chromeBannerHost'; + +const observers: Array<{ callback: () => void }> = []; + +class FakeResizeObserver { + callback: () => void; + constructor(callback: () => void) { + this.callback = callback; + observers.push(this); + } + observe() {} + unobserve() {} + disconnect() {} +} + +/** Every element with `data-h` reports that many pixels of height. */ +function stubHeights() { + return vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) { + const height = Number(this.getAttribute('data-h') ?? 0); + return { height, width: 0, top: 0, left: 0, right: 0, bottom: height, x: 0, y: 0, toJSON: () => ({}) } as DOMRect; + }); +} + +const published = () => document.documentElement.style.getPropertyValue(CHROME_BANNERS_HEIGHT_VAR); + +beforeEach(() => { + observers.length = 0; + vi.stubGlobal('ResizeObserver', FakeResizeObserver); + document.documentElement.style.removeProperty(CHROME_BANNERS_HEIGHT_VAR); +}); + +afterEach(() => { + cleanup(); + vi.unstubAllGlobals(); + vi.restoreAllMocks(); +}); + +describe('ChromeBannerSlot — the in-place banners publish their height (objectstack#37528)', () => { + it('in place: the summed height of the drawn banners, cleared on unmount', () => { + stubHeights(); + const { unmount } = render( + +
impersonating
+
read rate
+
, + ); + expect(published()).toBe('77px'); + + unmount(); + expect(published(), 'nothing drawn, nothing given back').toBe(''); + }); + + it('in place with no banner drawn (an ordinary session): nothing is published', () => { + stubHeights(); + render({null}); + expect(published()).toBe(''); + }); + + it('follows a banner that grows (it wraps on a narrow screen) or goes away', () => { + stubHeights(); + const Banners = ({ show, height }: { show: boolean; height: number }) => ( + {show ?
impersonating
: null}
+ ); + const { rerender, container } = render(); + expect(published()).toBe('41px'); + + container.querySelector('[data-h]')!.setAttribute('data-h', '77'); + act(() => observers.forEach((o) => o.callback())); + expect(published(), 'a resize republishes').toBe('77px'); + + rerender(); + act(() => observers.forEach((o) => o.callback())); + expect(published(), 'the banner ended').toBe(''); + }); + + it("drawn into an app layout's host: nothing is published", () => { + stubHeights(); + render( + <> + + +
impersonating
+
+ , + ); + expect(document.querySelector('[data-testid="console-chrome-banners"]')?.textContent).toContain('impersonating'); + expect(published()).toBe(''); + }); + + it('the full-height classes take the viewport less the published height, 0 when unset', () => { + for (const cls of Object.values(CONSOLE_FULL_HEIGHT)) { + expect(cls).toContain(`var(${CHROME_BANNERS_HEIGHT_VAR},0px)`); + } + }); +}); diff --git a/ui/packages/app-shell/src/layout/chromeBannerHost.tsx b/ui/packages/app-shell/src/layout/chromeBannerHost.tsx index 5c3ab0489d6..3aebfed57c2 100644 --- a/ui/packages/app-shell/src/layout/chromeBannerHost.tsx +++ b/ui/packages/app-shell/src/layout/chromeBannerHost.tsx @@ -53,8 +53,81 @@ export function ChromeBannerHost() { return
; } -/** Draws `children` into the app layout's host when one is mounted, in place otherwise. */ +/** + * The CSS custom property that carries the height of the banners drawn in + * place, above the console's routes: `0px` (unset) while none is drawn there. + */ +export const CHROME_BANNERS_HEIGHT_VAR = '--os-chrome-banners'; + +/** + * Full-height classes that give the banners drawn in place their height back + * (objectstack#37528). A banner in place is in flow above the page, so a page + * that takes the whole viewport would be taller than the window by the + * banner's height. Outside the console, or while no banner is drawn in place, + * the property is unset and these are the plain viewport heights. + * + * Literal strings, so Tailwind's scan sees every class. + */ +export const CONSOLE_FULL_HEIGHT = { + /** `h-screen` less the banners. */ + screen: 'h-[calc(100vh-var(--os-chrome-banners,0px))]', + /** `h-svh` less the banners. */ + svh: 'h-[calc(100svh-var(--os-chrome-banners,0px))]', + /** `min-h-svh` less the banners. */ + minSvh: 'min-h-[calc(100svh-var(--os-chrome-banners,0px))]', +} as const; + +/** + * Publishes the summed height of `wrapper`'s children as + * {@link CHROME_BANNERS_HEIGHT_VAR} on the document root, and clears it on + * unmount. The wrapper is `display: contents`, so the banners keep their own + * boxes (and the impersonation banner its `sticky`); each child is measured. + */ +function usePublishedBannerHeight(wrapper: React.RefObject) { + React.useLayoutEffect(() => { + const el = wrapper.current; + if (!el || typeof ResizeObserver === 'undefined') return undefined; + const root = document.documentElement; + const publish = () => { + let height = 0; + for (const child of Array.from(el.children)) height += child.getBoundingClientRect().height; + if (height > 0) root.style.setProperty(CHROME_BANNERS_HEIGHT_VAR, `${height}px`); + else root.style.removeProperty(CHROME_BANNERS_HEIGHT_VAR); + }; + const sizes = new ResizeObserver(publish); + const observeChildren = () => { + sizes.disconnect(); + for (const child of Array.from(el.children)) sizes.observe(child); + publish(); + }; + const children = typeof MutationObserver === 'undefined' ? null : new MutationObserver(observeChildren); + children?.observe(el, { childList: true }); + observeChildren(); + return () => { + sizes.disconnect(); + children?.disconnect(); + root.style.removeProperty(CHROME_BANNERS_HEIGHT_VAR); + }; + }, [wrapper]); +} + +function InPlaceBanners({ children }: { children: React.ReactNode }) { + const wrapper = React.useRef(null); + usePublishedBannerHeight(wrapper); + return ( +
+ {children} +
+ ); +} + +/** + * Draws `children` into the app layout's host when one is mounted, in place + * otherwise. In place, their height is published for the full-height pages + * below them ({@link CONSOLE_FULL_HEIGHT}); in the host it is not, since the + * host sits inside the content area the page already sizes. + */ export function ChromeBannerSlot({ children }: { children: React.ReactNode }) { const target = useChromeBannerHost(); - return target ? createPortal(children, target) : <>{children}; + return target ? createPortal(children, target) : {children}; } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index 99c7f9a62eb..dd25345a7f1 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -31,6 +31,7 @@ import { canonicalMetaUrlType } from '@objectstack/spec/shared'; import { resolveI18nLabel, type I18nLabel } from '@objectstack/spec/ui'; import { StudioChatDock, type StudioCopilotStatus, type StudioSurfaceLabel } from './StudioAiCopilot.js'; import { StudioRightSlot } from './StudioRightSlot.js'; +import { CONSOLE_FULL_HEIGHT } from '../../layout/chromeBannerHost.js'; import { StudioTitleRowProvider } from './studioTitleRow.js'; import { useStudioAccentOnBody } from './studioAccent.js'; import { AssistantTopBarButton } from '../../layout/AssistantTopBarButton.js'; @@ -1351,7 +1352,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re sidebar's, under Studio's own collapse cookie (`StudioMenu.tsx`). */} {/* objectstack#37455 — Studio's graphite on its root: nothing Studio draws takes the app's theme colour (decision 4 of #37424). */} - + {/* The ADR-0080 `aiSlot` seam — a cloud edition may still inject its own * left copilot panel; the built-in copilot is the RIGHT dock below. */} {/* objectstack#32615 — not beside a package that is not there. */} diff --git a/ui/packages/layout/src/AppShell.tsx b/ui/packages/layout/src/AppShell.tsx index 5b85bed47ff..3bdb3253fb7 100644 --- a/ui/packages/layout/src/AppShell.tsx +++ b/ui/packages/layout/src/AppShell.tsx @@ -305,7 +305,9 @@ export function AppShell({ useAppShellBranding(branding, branding?.title); return ( - + // The viewport less the banners the console draws above this shell + // (`--os-chrome-banners`, objectstack#37528); unset anywhere else. + {/* 1. Full-width top bar spanning entire screen. 48 px, the height of every console frame's bar (objectui#12639): the class is the one `@object-ui/app-shell` spells as `CONSOLE_TOP_BAR`, and that From f600750d31de8869882ebd1a428cec834e79febe Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:20:00 +0000 Subject: [PATCH 2/3] fix(layout): the sidebar wrapper's minimum height, and the Studio and app-state screens, give the banners their height back too Claude-Session: https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri Co-authored-by: Claude --- .changeset/37528-impersonation-banner-height.md | 2 +- ui/apps/console/src/components/StudioRoute.tsx | 2 +- ui/packages/app-shell/src/console/AppContent.tsx | 9 +++++---- ui/packages/layout/src/AppShell.tsx | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.changeset/37528-impersonation-banner-height.md b/.changeset/37528-impersonation-banner-height.md index 0aee7d20b68..e013508d25b 100644 --- a/.changeset/37528-impersonation-banner-height.md +++ b/.changeset/37528-impersonation-banner-height.md @@ -9,4 +9,4 @@ Clause-②: no Metadata-protocol: none - While an administrator impersonates a user, the console draws its banner above the page. Where it is drawn in place (every page on a phone, and Studio, Home and the organization pages on a desktop) the page below still took the whole viewport, so the document was taller than the window by the banner's height: a list's footer and bulk action bar sat below the fold and the page gained a second scrollbar. The same held for the read-rate and storage banners beside it. -- The banners drawn in place now publish their height as the CSS custom property `--os-chrome-banners` on the document root, and the console's full-height shells take the viewport less it: `AppShell` (`@object-ui/layout`), Studio, Home, the AI chat page and the organization layouts. While no banner is drawn in place, and anywhere outside the console, the property is unset and every shell keeps its viewport height. Inside an app on a desktop the banners are drawn into the content area, as before, and publish nothing. +- The banners drawn in place now publish their height as the CSS custom property `--os-chrome-banners` on the document root, and the console's full-height shells take the viewport less it: `AppShell` (`@object-ui/layout`, whose sidebar wrapper's own minimum height is overridden to match), Studio and its access-required screen, Home, the AI chat page, the organization layouts and the app-unavailable and no-app screens. While no banner is drawn in place, and anywhere outside the console, the property is unset and every shell keeps its viewport height. Inside an app on a desktop the banners are drawn into the content area, as before, and publish nothing. diff --git a/ui/apps/console/src/components/StudioRoute.tsx b/ui/apps/console/src/components/StudioRoute.tsx index 5f61e5f1a5f..cd09e10e5d6 100644 --- a/ui/apps/console/src/components/StudioRoute.tsx +++ b/ui/apps/console/src/components/StudioRoute.tsx @@ -103,7 +103,7 @@ function StudioAccessRequired({ home }: { home: string }) { // page, so the button says so, as the shell's other way-home buttons do. const phone = usePhoneViewport(); return ( -
+
diff --git a/ui/packages/app-shell/src/console/AppContent.tsx b/ui/packages/app-shell/src/console/AppContent.tsx index 609ea2c619c..fe10d466871 100644 --- a/ui/packages/app-shell/src/console/AppContent.tsx +++ b/ui/packages/app-shell/src/console/AppContent.tsx @@ -13,7 +13,7 @@ import { useState, useEffect, useLayoutEffect, useCallback, useRef, lazy, Suspen import { useAssistant } from '../assistant/assistantBus.js'; import { LazyModalForm } from '../views/lazyFormSurfaces.js'; import { ConsoleFormOwnerLine } from '../views/consoleFormOwnerLine.js'; -import { Empty, EmptyTitle, EmptyDescription, Button, DataErrorState } from '@object-ui/components'; +import { Empty, EmptyTitle, EmptyDescription, Button, DataErrorState, cn } from '@object-ui/components'; import { toast } from 'sonner'; import { useActionRunner, useGlobalUndo, useMutationInvalidationBridge, notifyDataChanged, FilterScopeProvider, resolveApprovalLock, claimAnswerWarnings, toastRecordSave, type AnswerWarningClaim, type AnsweredLoadFailure, type RecordSaveFeedback } from '@object-ui/react'; import { useRecordApprovals, openApprovalOf } from '../hooks/useRecordApprovals.js'; @@ -45,6 +45,7 @@ import type { NavigationItem } from '@object-ui/types'; // Components (eagerly loaded — always needed) import { ConsoleLayout } from '../layout/ConsoleLayout.js'; +import { CONSOLE_FULL_HEIGHT } from '../layout/chromeBannerHost.js'; import { CommandPalette } from '../chrome/CommandPalette.js'; import { ErrorBoundary } from '../chrome/ErrorBoundary.js'; import { LoadingScreen } from '../chrome/LoadingScreen.js'; @@ -1318,7 +1319,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // One screen for both branches that draw a `denied` verdict below. const renderAppAccessDenied = () => ( -
+
{t('empty.appAccessDenied', { defaultValue: "You don't have access to this app" })} @@ -1398,7 +1399,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = return ( +
{t('empty.noAppsConfigured')} diff --git a/ui/packages/layout/src/AppShell.tsx b/ui/packages/layout/src/AppShell.tsx index 3bdb3253fb7..e4de6adb699 100644 --- a/ui/packages/layout/src/AppShell.tsx +++ b/ui/packages/layout/src/AppShell.tsx @@ -306,8 +306,9 @@ export function AppShell({ return ( // The viewport less the banners the console draws above this shell - // (`--os-chrome-banners`, objectstack#37528); unset anywhere else. - + // (`--os-chrome-banners`, objectstack#37528); unset anywhere else. The + // `min-h-` replaces the sidebar wrapper's own `min-h-svh` (tailwind-merge). + {/* 1. Full-width top bar spanning entire screen. 48 px, the height of every console frame's bar (objectui#12639): the class is the one `@object-ui/app-shell` spells as `CONSOLE_TOP_BAR`, and that From ce889b5f6fb22746a7669181fec08b85f2d8756d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:44:35 +0000 Subject: [PATCH 3/3] chore(changeset): name @object-ui/console for the StudioRoute height (#37528) StudioRoute.tsx lives in the published @object-ui/console package. Claude-Session: https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri Co-authored-by: Claude --- .changeset/37528-impersonation-banner-height.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.changeset/37528-impersonation-banner-height.md b/.changeset/37528-impersonation-banner-height.md index e013508d25b..e93b66cc813 100644 --- a/.changeset/37528-impersonation-banner-height.md +++ b/.changeset/37528-impersonation-banner-height.md @@ -1,6 +1,7 @@ --- '@object-ui/app-shell': patch '@object-ui/layout': patch +'@object-ui/console': patch --- fix(app-shell): a full-height console page gives the impersonation banner its height back