From adb23b2090dd791a5aae4b2e70f0a9710305b749 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 11:51:44 +0000 Subject: [PATCH 1/2] fix(record-page): the record header's Edit is an outline button, the desktop header row 28 high MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The host's Edit no longer draws as the filled primary when the object declares no header action; the page's own actions keep their pick and faces, the edit state's Save stays filled, the phone bar is unchanged. Every desktop header-row button, the ⋯, the approval levers there and the trailing panel toggles are 28 high (`sm:h-7`); a declared `size` wins. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L6bhgTFnmxG5snBaBLNBei --- .changeset/36049-record-edit-outline.md | 15 +++ content/docs/ui/components/page.mdx | 2 +- scripts/sdui-manifest.record.json | 2 +- sdui.manifest.json | 2 +- .../src/views/DeclaredActionsBar.tsx | 6 +- .../app-shell/src/views/RecordDetailView.tsx | 9 +- .../page-header-danger-12764.test.tsx | 6 +- .../page-header-edit-outline-36049.test.tsx | 113 ++++++++++++++++++ .../page-header-primary-12617.test.tsx | 7 +- .../components/src/custom/panel-toggles.tsx | 4 +- .../src/renderers/layout/containers.tsx | 26 +++- 11 files changed, 173 insertions(+), 19 deletions(-) create mode 100644 .changeset/36049-record-edit-outline.md create mode 100644 ui/packages/components/src/__tests__/page-header-edit-outline-36049.test.tsx diff --git a/.changeset/36049-record-edit-outline.md b/.changeset/36049-record-edit-outline.md new file mode 100644 index 00000000000..f0b2008db88 --- /dev/null +++ b/.changeset/36049-record-edit-outline.md @@ -0,0 +1,15 @@ +--- +'@object-ui/components': patch +'@object-ui/app-shell': patch +--- + +fix(record-page): the record header's Edit is an outline button, and the desktop header row is one height, 28 + +Clause-②: no +Metadata-protocol: none + +On a record whose object declares no header action of its own, the host's Edit was drawn as the page's one filled button, 36 high, louder than the record's name, though the record's fields already edit in place. It is now an outline button everywhere in the header row, in the record page and in the record drawer alike. What Edit does when pressed is unchanged. + +- **The page's own actions keep their faces.** An action declaring `variant: 'primary'` is still the filled button; with none, the first page action still is. The record edit state's Save stays filled. +- **One row height.** On desktop every button in the record header row is 28 high: Edit, the page's own actions, the `⋯`, the approval levers a record under approval shows there, and the trailing panel toggles (32 before). `page:header` is a shared block, so a custom page's header actions get 28 too. An action that declares its own `size` keeps it. +- **Phones unchanged.** The phone's bottom action bar still draws Edit filled at 44, and the phone header rows keep 36. diff --git a/content/docs/ui/components/page.mdx b/content/docs/ui/components/page.mdx index 5b2c2bf2385..8e0241a0e40 100644 --- a/content/docs/ui/components/page.mdx +++ b/content/docs/ui/components/page.mdx @@ -55,7 +55,7 @@ Namespace `page`. | `placedActions` | `boolean` | | Set true to draw every action of the object placed at record_header or record_more, read live from the object's metadata, in place of an Actions list: an action another package adds to the object is drawn without editing the page. Refused beside an authored Actions list: keep one. | | `recordChrome` | `boolean` | | Set false for the bare h1 header on non-record pages | | `showCopyId` | `boolean` | | — | -| `maxVisible` | `number` | | How many header actions render as inline buttons on desktop before the rest fold into the overflow menu. A positive integer, defaulting to 3 — the contract rejects 0 and fractional values. In a record page's header bar, actions that do not fit its width fold too, so a narrow drawer shows fewer. Two kinds of action are routed to the overflow menu regardless of this budget and never occupy an inline slot: an action whose locations declare record_more without record_header, and any action with component action:menu. The host's own buttons (the record page's Edit) take no slot and never fold. The first inline action, or the one declaring variant primary, is the one filled primary button; the others are outline buttons. An action declaring variant danger is never the primary: inline it is a destructive button, and in the overflow menu it is a red row below a separator. | +| `maxVisible` | `number` | | How many header actions render as inline buttons on desktop before the rest fold into the overflow menu. A positive integer, defaulting to 3 — the contract rejects 0 and fractional values. In a record page's header bar, actions that do not fit its width fold too, so a narrow drawer shows fewer. Two kinds of action are routed to the overflow menu regardless of this budget and never occupy an inline slot: an action whose locations declare record_more without record_header, and any action with component action:menu. The host's own buttons (the record page's Edit) take no slot and never fold. The first inline action, or the one declaring variant primary, is the one filled primary button; the others are outline buttons. The host's Edit is always an outline button: on a record with no header action of its own the row has no filled button. An action declaring variant danger is never the primary: inline it is a destructive button, and in the overflow menu it is a red row below a separator. | | `mobileMaxVisible` | `number` | | The same inline-button budget on mobile viewports, where horizontal room is scarce. A positive integer, defaulting to 1, or 2 in a record page's bottom action bar on a phone, where the host's Edit counts as one; the desktop half is Max Inline Actions, and the overflow routing rules stated there apply unchanged. | ## `page:section` [#page-section] diff --git a/scripts/sdui-manifest.record.json b/scripts/sdui-manifest.record.json index 31605bd4997..81ae70827fc 100644 --- a/scripts/sdui-manifest.record.json +++ b/scripts/sdui-manifest.record.json @@ -14,7 +14,7 @@ "source": "built-tree", "generator": "scripts/gen-sdui-manifest-node.mjs", "generatedAt": "2026-11-21", - "sha256": "6d9807f35ed3bc4d4dc727fe6fe9ad76c8667cc5666daef03336b5df28bcda69", + "sha256": "16ff838b7448ca0e59019fe61016e0c4d3ab9654239fc4beded2238b801ee2cf", "components": 106, "inTree": { "modulesRoot": "ui/apps/console", diff --git a/sdui.manifest.json b/sdui.manifest.json index 2ca21407a4a..1402ef27d30 100644 --- a/sdui.manifest.json +++ b/sdui.manifest.json @@ -3539,7 +3539,7 @@ { "name": "maxVisible", "type": "number", - "description": "How many header actions render as inline buttons on desktop before the rest fold into the overflow menu. A positive integer, defaulting to 3 — the contract rejects 0 and fractional values. In a record page's header bar, actions that do not fit its width fold too, so a narrow drawer shows fewer. Two kinds of action are routed to the overflow menu regardless of this budget and never occupy an inline slot: an action whose locations declare record_more without record_header, and any action with component action:menu. The host's own buttons (the record page's Edit) take no slot and never fold. The first inline action, or the one declaring variant primary, is the one filled primary button; the others are outline buttons. An action declaring variant danger is never the primary: inline it is a destructive button, and in the overflow menu it is a red row below a separator." + "description": "How many header actions render as inline buttons on desktop before the rest fold into the overflow menu. A positive integer, defaulting to 3 — the contract rejects 0 and fractional values. In a record page's header bar, actions that do not fit its width fold too, so a narrow drawer shows fewer. Two kinds of action are routed to the overflow menu regardless of this budget and never occupy an inline slot: an action whose locations declare record_more without record_header, and any action with component action:menu. The host's own buttons (the record page's Edit) take no slot and never fold. The first inline action, or the one declaring variant primary, is the one filled primary button; the others are outline buttons. The host's Edit is always an outline button: on a record with no header action of its own the row has no filled button. An action declaring variant danger is never the primary: inline it is a destructive button, and in the overflow menu it is a red row below a separator." }, { "name": "mobileMaxVisible", diff --git a/ui/packages/app-shell/src/views/DeclaredActionsBar.tsx b/ui/packages/app-shell/src/views/DeclaredActionsBar.tsx index ad4606cc68a..51e7043c57f 100644 --- a/ui/packages/app-shell/src/views/DeclaredActionsBar.tsx +++ b/ui/packages/app-shell/src/views/DeclaredActionsBar.tsx @@ -758,7 +758,7 @@ const DeclaredActionButton: React.FC<{ // the record header's spelling (`PageHeaderActions`). // Below `sm` a 44 px touch target (objectstack#29071). className={cn( - headerTone ? 'h-11 sm:h-8' : 'h-11 sm:h-9', + headerTone ? 'h-11 sm:h-7' : 'h-11 sm:h-9', fill && (disabledReason ? 'w-full sm:w-auto' : 'flex-1 sm:flex-none'), headerTone === 'secondary' && declaredVariant === 'danger' && !isOverride && 'text-destructive hover:text-destructive', @@ -1112,7 +1112,7 @@ const DeclaredActionsToolbar: React.FC< size="sm" className={cn( 'gap-1 px-2 border-amber-500/60 text-amber-700 hover:bg-amber-50 hover:text-amber-800 dark:text-amber-400 dark:hover:bg-amber-500/10 dark:hover:text-amber-300', - barFace ? 'h-11 shrink-0' : 'h-8', + barFace ? 'h-11 shrink-0' : 'h-8 sm:h-7', )} aria-label={overrideMenuLabel} title={overrideMenuLabel} @@ -1168,7 +1168,7 @@ const DeclaredActionsToolbar: React.FC< type="button" variant="outline" size="sm" - className={barFace ? 'h-11 w-11 shrink-0 px-0' : 'h-8 gap-1 px-2'} + className={barFace ? 'h-11 w-11 shrink-0 px-0' : 'h-8 gap-1 px-2 sm:h-7'} aria-label={moreLabel} data-testid="declared-actions-header-menu" > diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index c64498a00a4..d4614c5ea50 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -4877,10 +4877,11 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // same `icon` key the app's actions use, so every row draws one kind // of entry. `page:header` keeps this CTA a labelled button in the row // at every width: it takes none of the app's `maxVisible` slots and - // never folds into the `⋯` (objectui#12617). It is the filled primary - // button only when the record has no app action ahead of it; next to - // app actions it is an outline button, which `page:header` decides — - // no `variant` is declared here for it to read. + // never folds into the `⋯` (objectui#12617). It is an outline button + // in the header row whether or not the record has app actions + // (objectstack#36049; before, it drew filled when it had none); + // `page:header` decides that — no `variant` is declared here for it + // to read. The phone's bottom bar still draws it filled. icon: 'pencil', type: 'script', locations: ['record_header'], diff --git a/ui/packages/components/src/__tests__/page-header-danger-12764.test.tsx b/ui/packages/components/src/__tests__/page-header-danger-12764.test.tsx index e4cc70263e2..30d0c4b5bd0 100644 --- a/ui/packages/components/src/__tests__/page-header-danger-12764.test.tsx +++ b/ui/packages/components/src/__tests__/page-header-danger-12764.test.tsx @@ -119,11 +119,13 @@ describe("page:header reads the spec's variant 'danger' as destructive (objectui expect(buttons.filter(isFilled)).toHaveLength(1); }); - it('with only a danger action, the host Edit is the primary and the danger action stays destructive', () => { + // objectstack#36049 — the host Edit still takes the pick (it leads the row) + // but draws outline: the row has no filled button. + it('with only a danger action, the host Edit leads as an outline button and the danger action stays destructive', () => { renderHeader([act('leave_organization', 'Leave Organization', { variant: 'danger' })]); const buttons = rowButtons(); expect(buttons.map(nameOf)).toEqual(['Edit', 'Leave Organization']); - expect(isFilled(buttons[0])).toBe(true); + expect(isFilled(buttons[0])).toBe(false); expect(isFilled(buttons[1])).toBe(false); expect(isDestructiveButton(buttons[1])).toBe(true); }); diff --git a/ui/packages/components/src/__tests__/page-header-edit-outline-36049.test.tsx b/ui/packages/components/src/__tests__/page-header-edit-outline-36049.test.tsx new file mode 100644 index 00000000000..6323c4c27f0 --- /dev/null +++ b/ui/packages/components/src/__tests__/page-header-edit-outline-36049.test.tsx @@ -0,0 +1,113 @@ +/** + * ObjectUI + * Copyright (c) 2024-present ObjectStack Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** + * objectstack#36049 — the record header's Edit is an outline button and the + * desktop header row is one height, 28 (`sm:h-7`). + * + * Before: on a record whose object declares no header action, the host's Edit + * was the row's pick and drew as the one filled button (36 high), louder than + * the record's name. Now it is outline; the page's own actions keep their + * pick and their faces (a declared `variant: 'primary'` stays filled), only + * their height follows the row. An action declaring its own `size` keeps it. + * The phone's bottom bar is unchanged (`page-header-phone-bar-27058`). + */ + +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import { ComponentRegistry } from '@object-ui/core'; +import { ActionProvider, RecordContextProvider } from '@object-ui/react'; +import '../renderers'; +import '@object-ui/react-runtime'; +import { PanelToggles } from '../custom/panel-toggles'; + +function PageHeader({ schema }: { schema: any }) { + const Component = ComponentRegistry.get('page:header'); + if (!Component) throw new Error('page:header not registered'); + // eslint-disable-next-line react-hooks/static-components -- ComponentRegistry.get returns a registered component (stable), not one created during render + return ; +} + +const DEAL = { id: 'opp-1', name: 'Acme renewal' }; +const HOST_ACTIONS = [ + { name: 'sys_edit', label: 'Edit', icon: 'pencil', order: 100, onClick: vi.fn() }, + { name: 'sys_share', label: 'Share', order: 110, component: 'action:menu', onClick: vi.fn() }, +]; + +function renderHeader(actions: any[]) { + return render( + + + + + , + ); +} + +const act = (name: string, label: string, extra: Record = {}) => ({ + name, + label, + type: 'url', + target: `https://example.com/${name}`, + locations: ['record_header'], + ...extra, +}); + +const button = (name: string) => screen.getByRole('button', { name }); +const classes = (b: HTMLElement) => b.className.split(/\s+/); +const isFilled = (b: HTMLElement) => classes(b).includes('bg-primary'); +const isOutline = (b: HTMLElement) => classes(b).includes('border-input'); +const is28 = (b: HTMLElement) => classes(b).includes('sm:h-7'); + +describe('page:header — the record Edit is outline, the desktop row 28 high (objectstack#36049)', () => { + it('a record with no header action: Edit is outline, 28 high, and the ⋯ beside it is 28 too', () => { + renderHeader([]); + const edit = button('Edit'); + expect(isFilled(edit)).toBe(false); + expect(isOutline(edit)).toBe(true); + expect(is28(edit)).toBe(true); + expect(is28(button('More actions'))).toBe(true); + }); + + it("a declared `variant: 'primary'` action keeps its filled face; only its height follows the row", () => { + renderHeader([act('submit_approval', 'Submit for approval', { variant: 'primary' })]); + const submit = button('Submit for approval'); + expect(isFilled(submit)).toBe(true); + expect(is28(submit)).toBe(true); + expect(isOutline(button('Edit'))).toBe(true); + }); + + it('the first page action without a variant is still the filled one (its pick is unchanged)', () => { + renderHeader([act('convert', 'Convert')]); + expect(isFilled(button('Convert'))).toBe(true); + expect(isFilled(button('Edit'))).toBe(false); + }); + + it('an action that declares its own `size` keeps it — no row height is forced on it', () => { + renderHeader([act('big', 'Big', { size: 'lg' })]); + expect(is28(button('Big'))).toBe(false); + }); + + it("the trailing panel toggles are 28 high, the row's one height", () => { + render( + null, pressed: true, onPressedChange: () => {} }]} + />, + ); + const toggle = screen.getByRole('button', { name: 'Right panel' }); + expect(classes(toggle)).toContain('h-7'); + expect(classes(toggle)).not.toContain('h-8'); + }); +}); diff --git a/ui/packages/components/src/__tests__/page-header-primary-12617.test.tsx b/ui/packages/components/src/__tests__/page-header-primary-12617.test.tsx index ee06fae6231..3a56c22aa93 100644 --- a/ui/packages/components/src/__tests__/page-header-primary-12617.test.tsx +++ b/ui/packages/components/src/__tests__/page-header-primary-12617.test.tsx @@ -154,11 +154,14 @@ describe('page:header draws one primary action, the rest secondary (objectui#126 expect(isFilled(convert)).toBe(true); }); - it('with no app action, the host Edit is the primary button', () => { + // objectstack#36049 — was "the host Edit is the primary button": with no + // app action the row now has no filled button; Edit is outline. + it('with no app action, the host Edit is an outline button and nothing is filled', () => { renderRecordHeader([]); const buttons = toolbarButtons().filter((b) => nameOf(b) !== 'More actions'); expect(buttons.map(nameOf)).toEqual(['Edit']); - expect(isFilled(buttons[0])).toBe(true); + expect(isFilled(buttons[0])).toBe(false); + expect(isOutline(buttons[0])).toBe(true); }); }); diff --git a/ui/packages/components/src/custom/panel-toggles.tsx b/ui/packages/components/src/custom/panel-toggles.tsx index c998a0eb8c2..6e09bb963f4 100644 --- a/ui/packages/components/src/custom/panel-toggles.tsx +++ b/ui/packages/components/src/custom/panel-toggles.tsx @@ -57,7 +57,7 @@ export function PanelToggles({ items, label, className }: PanelTogglesProps) {
{items.map((item) => { @@ -72,7 +72,7 @@ export function PanelToggles({ items, label, className }: PanelTogglesProps) { aria-label={item.label} aria-keyshortcuts={item.ariaKeyShortcuts} className={cn( - 'h-8 w-8 min-w-0 rounded-md p-0 text-muted-foreground', + 'h-7 w-7 min-w-0 rounded-md p-0 text-muted-foreground', 'hover:bg-muted hover:text-foreground', // `aria-pressed`, not Radix's `data-state`: the tooltip // trigger writes its own `data-state` onto this button. diff --git a/ui/packages/components/src/renderers/layout/containers.tsx b/ui/packages/components/src/renderers/layout/containers.tsx index ee2b502c6eb..42cae50bc03 100644 --- a/ui/packages/components/src/renderers/layout/containers.tsx +++ b/ui/packages/components/src/renderers/layout/containers.tsx @@ -2840,9 +2840,28 @@ export const PageHeaderActions: React.FC = ({ // Shadcn's `default`; a destructive action shown inline is Shadcn's // `destructive` (objectui#12764); every other inline button is an // outline button (objectui#12617). + // + // objectstack#36049 — the host's Edit is never filled in the header + // row. On a record whose object declares no header action, Edit was + // the pick and drew as the page's one solid button, louder than the + // record's name, though the record's fields edit in place. It now + // draws outline there too; the page's own actions keep their pick and + // their faces, and a host button DECLARING `variant: 'primary'` (the + // edit state's Save, objectstack#35816) stays filled. The phone's + // bottom bar keeps its filled Edit: there it is the bar's one big + // target. + const hostEditPick = + action === primaryAction && !barFace && isHostAction(action) && action?.variant !== 'primary'; const variant = - action === primaryAction ? 'default' : isDestructiveAction(action) ? 'destructive' : 'outline'; + action === primaryAction && !hostEditPick + ? 'default' + : isDestructiveAction(action) ? 'destructive' : 'outline'; const size = action.size || 'sm'; + // objectstack#36049 — the desktop header row is one height, 28 (`h-7`): + // its buttons, the `⋯`, the trailing panel toggles. An action that + // declares its own `size` keeps it; the phone's rows keep `sm`'s 36, + // and its bottom bar its 44. + const rowHeight = !barFace && !action.size ? 'sm:h-7' : undefined; const actionKey = action.name || action.id || `header-action-${idx}`; const pending = pendingActionKeys.has(actionKey); const disabled = isActionDisabled(action); @@ -2865,6 +2884,7 @@ export const PageHeaderActions: React.FC = ({ // same spelling as `PanelToggles` and `DeclaredActionsBar`). className={cn( 'gap-2', + rowHeight, barFace && 'h-11 min-w-0 flex-1', pending && 'cursor-progress opacity-50', pressed !== undefined && 'aria-pressed:bg-accent aria-pressed:text-accent-foreground hover:aria-pressed:bg-accent', @@ -2977,7 +2997,7 @@ export const PageHeaderActions: React.FC = ({