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
15 changes: 15 additions & 0 deletions .changeset/36049-record-edit-outline.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion content/docs/ui/components/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion scripts/sdui-manifest.record.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion sdui.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions ui/packages/app-shell/src/views/DeclaredActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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"
>
Expand Down
9 changes: 5 additions & 4 deletions ui/packages/app-shell/src/views/RecordDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import { ActionProvider, RecordContextProvider } from '@object-ui/react';
// Registers `page:header` at module scope rather than in a hook
// (object-ui/no-dynamic-import-in-test-hook, objectui#3010).
import '../renderers';
// `page` reaches the react runtime through a dynamic import: pay that load at
// collection, not inside a clocked case.
import '@object-ui/react-runtime';

function PageHeader({ schema }: { schema: any }) {
const Component = ComponentRegistry.get('page:header');
Expand Down Expand Up @@ -119,11 +122,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);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <Component schema={schema} />;
}

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(
<ActionProvider>
<RecordContextProvider
objectName="opportunity"
recordId={DEAL.id}
data={DEAL}
objectSchema={{ name: 'opportunity', label: 'Opportunity' }}
headerSystemActions={HOST_ACTIONS}
>
<PageHeader schema={{ type: 'page:header', actions }} />
</RecordContextProvider>
</ActionProvider>,
);
}

const act = (name: string, label: string, extra: Record<string, unknown> = {}) => ({
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(
<PanelToggles
label="Panels"
items={[{ id: 'aside', label: 'Right panel', icon: () => 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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand Down
4 changes: 2 additions & 2 deletions ui/packages/components/src/custom/panel-toggles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function PanelToggles({ items, label, className }: PanelTogglesProps) {
<div
role="group"
aria-label={label}
className={cn('inline-flex h-8 items-center gap-0.5', className)}
className={cn('inline-flex h-7 items-center gap-0.5', className)}
data-panel-toggles=""
>
{items.map((item) => {
Expand All @@ -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.
Expand Down
Loading
Loading