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
24 changes: 24 additions & 0 deletions .changeset/36151-phone-bottom-bar-actions-only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@objectstack/spec': minor
'@object-ui/components': minor
'@object-ui/app-shell': minor
---

feat(record-page): on a phone the record page's bottom bar holds the object's own actions only, and Edit moves into the More menu at the top bar's right end

Clause-②: yes (widening)
Metadata-protocol: semantic

On a phone the record page's bottom bar used to always draw Edit first, then the primary action and the `⋯`; an object with no action of its own got a full-width Edit and nothing else. A field's value is now edited by a tap on it, so on a phone:

- The bottom bar draws the object's actions only: the primary and the next one (the default budget of 2 is unchanged), filling the row. The record's edit state keeps its Cancel and Save there.
- With no action to draw, no bottom bar is drawn and the page body runs to the foot of the screen.
- The `⋯` moves to the right end of the top bar. It holds Edit (on or off, with the reason when it is off), the actions that did not fit, Refresh, Share and Delete. (Favorites is not in it: the favorite star sits beside the record's name.) Edit there does what the bar's Edit did.
- A record pending the reader's approval is unchanged: the bar is the approval's decisions and its own `⋯`.
- The desktop header is unchanged.

`page:header` `mobileMaxVisible` keeps its default of 2 in the phone bar, but Edit no longer takes one of those slots, so an unset budget now shows two of the page's actions where it showed one, and an authored value counts the page's actions alone. Host buttons still take bar slots ahead of the page's actions: the queue's Claim, and in the record's edit state its Cancel and Save. Its description in the spec, the designer and the docs says so.

Migrating: an author who wants the earlier number of page actions in the phone bar lowers `mobileMaxVisible` by one. An authored `1` that meant "Edit only" now shows the primary action; to keep the bar free of inline actions, mark the page's actions `component: 'action:menu'` so they fold into the `⋯`.

`@object-ui/components`: `PageHeaderPhoneFace` (the value of `PageHeaderPhoneContext`) gains an optional `more` slot. A host that hands it gets the `⋯` drawn there, and a bar with no button draws nothing; a host that does not keeps the `⋯` as the bar's last button, as before.
2 changes: 1 addition & 1 deletion content/docs/references/ui/component.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
| **showStar** | `never` | optional | [REMOVED] `page:header` property `showStar` was removed in @objectstack/spec 18 (ADR-0087 D2) — the console draws the record's star from the host's favorites toggle, never from metadata, so the key switched nothing. Delete the key, whether it was `true` or `false`; the page draws the same star without it. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
| **showCopyId** | `boolean` | optional (default: `true`) | Show the copy-record-id button beside the record title. Part of the record chrome — no effect when `recordChrome` is false. |
| **maxVisible** | `integer` | optional | How many header actions render as inline buttons before the rest fold into the overflow menu. Renderer default when unset: 3 on every header. In a record page's header bar the number, authored or not, is an upper bound: actions that do not fit the bar's width fold as well, so a narrow drawer shows fewer. |
| **mobileMaxVisible** | `integer` | optional | The `maxVisible` budget on mobile viewports. Renderer default when unset: 2 in a record page's bottom action bar on a phone, where the host's Edit counts as one, 1 on any other header. |
| **mobileMaxVisible** | `integer` | optional | The `maxVisible` budget on mobile viewports. Renderer default when unset: 2 in a record page's bottom action bar on a phone, 1 on any other header. The phone bar holds the page's own actions: the record's Edit is not one of them, it is in the overflow menu at the top bar's right end. |
| **aria** | `{ ariaLabel?: string \| Record<string, string>; ariaDescribedBy?: string; role?: string }` | optional | ARIA accessibility attributes |

### Nested Shape: `PageHeaderProps.aria`
Expand Down
2 changes: 1 addition & 1 deletion content/docs/ui/components/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Namespace `page`.
| `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. 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. |
| `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, which holds the page's actions (the record's Edit is in the top bar's overflow menu there); 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 content/docs/ui/pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ unknown or retired key (`description`, `icon`, `breadcrumb`, `showStar`) is refu
| `placedActions` | — | `true` asks for every action of the object placed at `record_header` / `record_more`, read live, in place of an `actions` list, so an action another package adds is drawn without editing the page. Refused beside an authored `actions` list: keep one. The platform's user, organization and approval request pages set it |
| `recordChrome` | `true` | Draw the title as the record chip (object label, copy-id button, the record's picture when the object names an `imageField`); `false` keeps a bare heading |
| `showCopyId` | `true` | The copy-record-id button in the chip |
| `maxVisible` / `mobileMaxVisible` | 3 on every header (in a record page's header bar the number, authored or not, is an upper bound: actions that do not fit the bar's width fold as well) / 2 in a phone record page's bottom bar (the Edit button counts as one), 1 elsewhere | How many actions render inline before the rest fold into the `⋯` menu |
| `maxVisible` / `mobileMaxVisible` | 3 on every header (in a record page's header bar the number, authored or not, is an upper bound: actions that do not fit the bar's width fold as well) / 2 in a phone record page's bottom bar (the page's own actions; Edit is in the top bar's `⋯` there), 1 elsewhere | How many actions render inline before the rest fold into the `⋯` menu |
| `aria` | — | ARIA attributes (`ariaLabel`, `ariaDescribedBy`, …) for the `<header>` element |

A named action renders only if its `locations` include `record_header` (inline) or
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/src/ui/component.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ export const PageHeaderProps = strictObject({
'How many header actions render as inline buttons before the rest fold into the overflow menu. Renderer default when unset: 3 on every header. In a record page\'s header bar the number, authored or not, is an upper bound: actions that do not fit the bar\'s width fold as well, so a narrow drawer shows fewer.',
),
mobileMaxVisible: z.number().int().positive().optional().describe(
'The `maxVisible` budget on mobile viewports. Renderer default when unset: 2 in a record page\'s bottom action bar on a phone, where the host\'s Edit counts as one, 1 on any other header.',
'The `maxVisible` budget on mobile viewports. Renderer default when unset: 2 in a record page\'s bottom action bar on a phone, 1 on any other header. The phone bar holds the page\'s own actions: the record\'s Edit is not one of them, it is in the overflow menu at the top bar\'s right end.',
),
/** ARIA accessibility */
aria: AriaPropsSchema.optional().describe('ARIA accessibility attributes'),
Expand Down
4 changes: 2 additions & 2 deletions scripts/sdui-manifest.record.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
],
"source": "built-tree",
"generator": "scripts/gen-sdui-manifest-node.mjs",
"generatedAt": "2026-11-21",
"sha256": "16ff838b7448ca0e59019fe61016e0c4d3ab9654239fc4beded2238b801ee2cf",
"generatedAt": "2026-11-22",
"sha256": "f3dbc8227184b481722038c25df8027ec0b7546957cda33d6d718fe643ff3bf3",
"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 @@ -3544,7 +3544,7 @@
{
"name": "mobileMaxVisible",
"type": "number",
"description": "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."
"description": "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, which holds the page's actions (the record's Edit is in the top bar's overflow menu there); the desktop half is Max Inline Actions, and the overflow routing rules stated there apply unchanged."
}
]
},
Expand Down
9 changes: 6 additions & 3 deletions ui/e2e/record-flow-phone-targets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ const CLS = {
composerRow: g('composer', /<div className=\{cn\('(flex flex-wrap items-center gap-0\.5[^']*)'/, ['flex-wrap']),
composerButton: g('composer', /className="(h-11 w-11 sm:h-7 sm:w-7)"/, ['h-11', 'sm:h-7']),
barButton: g('header', /barFace && '(h-11 min-w-0 flex-1)'/, ['h-11', 'flex-1']),
barMore: g('header', /barFace \? '(h-11 w-11 shrink-0 px-0)'/, ['h-11', 'w-11']),
// objectstack#36151 — the record page hands the `⋯` a slot at the top bar's
// right end on a phone; the bar holds the page's actions alone.
topMore: g('header', /moreInTopBar\s*\? '(h-11 w-11 shrink-0 px-0 [^']*)'/, ['h-11', 'w-11']),
back: g('page', /const phoneBackClass =\s*'([^']+)'/, ['min-h-[44px]']),
topBar: g('topBar', /'(flex min-h-11 sm:h-11 [^']*)'/, ['min-h-11', 'sm:h-11']),
topBarButton: g('topBar', /const RECORD_TOP_BAR_BUTTON_CLASS =\s*'([^']+)'/, ['h-11', 'w-11', 'sm:h-7']),
Expand All @@ -122,7 +124,7 @@ const CLS = {
})(),
};

/** The record page, transcribed: the back link, the tabs, a section field with its pencil, a related card, the inline save bar and the bottom action bar. */
/** The record page, transcribed: the back link and the top bar's `⋯`, the tabs, a section field with its pencil, a related card, the inline save bar and the bottom action bar. */
const fixture = () => {
const b = (cls: string, label: string, extra = '') =>
`<button type="button" class="${CLS.buttonBase} px-3 ${cls}" data-t="${label}" ${extra}>${label.length > 2 ? label : '<svg width="16" height="16"></svg>'}</button>`;
Expand All @@ -133,6 +135,7 @@ const fixture = () => {
<div class="flex shrink-0 items-center gap-0.5"><span class="mr-1">3 / 21</span>
<button type="button" class="${CLS.topBarButton}" data-t="next record"><svg width="14" height="14"></svg></button>
<button type="button" class="${CLS.topBarButton}" data-t="previous record"><svg width="14" height="14"></svg></button>
${b(CLS.topMore, 'TM')}
</div>
</div>
<div class="px-4">
Expand Down Expand Up @@ -174,7 +177,7 @@ const fixture = () => {
</div>
</div>
<div class="shrink-0 border-t px-4 pt-3 pb-3"><div class="flex items-center gap-2">
${b(`gap-2 ${CLS.barButton}`, 'Edit')}${b(`gap-2 ${CLS.barButton}`, 'Convert Lead')}${b(CLS.barMore, 'MA')}
${b(`gap-2 ${CLS.barButton}`, 'Convert Lead')}${b(`gap-2 ${CLS.barButton}`, 'Assign')}
</div></div>
</div>`;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const METADATA = {
const STORE_KEY = 'objectui-favorites';
const stored = (): FavoriteItem[] => JSON.parse(localStorage.getItem(STORE_KEY) ?? '[]');

async function mountRecordPage(opts: { embedded?: boolean } = {}) {
async function mountRecordPage(opts: { embedded?: boolean; ready?: string } = {}) {
const dataSource = {
find: vi.fn(async () => ({ data: [] })),
findOne: vi.fn(async () => ({ id: RECORD_ID, name: 'Intro call' })),
Expand Down Expand Up @@ -139,7 +139,9 @@ async function mountRecordPage(opts: { embedded?: boolean } = {}) {
</I18nProvider>,
);
await waitFor(() => expect(dataSource.findOne).toHaveBeenCalled());
await waitFor(() => expect(document.querySelector('[role="toolbar"]')).toBeTruthy());
// The header's actions are drawn: its toolbar, or on a phone whose object
// declares no action of its own, the top bar's ⋯ (objectstack#36151).
await waitFor(() => expect(document.querySelector(opts.ready ?? '[role="toolbar"]')).toBeTruthy());
}

/** The record header's favorite star, by either of its two names. */
Expand All @@ -156,8 +158,7 @@ function isFilled(star: HTMLElement): boolean {
}

/** Opens the header's overflow and returns its entries' text. */
async function openOverflow(): Promise<string[]> {
const [trigger] = screen.getAllByRole('button', { name: 'More actions' });
async function openOverflow(trigger: HTMLElement = screen.getAllByRole('button', { name: 'More actions' })[0]): Promise<string[]> {
fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false, pointerType: 'mouse' });
await waitFor(() => expect(screen.getByRole('menu')).toBeInTheDocument());
return screen.getAllByRole('menuitem').map((el) => (el.textContent ?? '').trim());
Expand Down Expand Up @@ -277,17 +278,25 @@ describe('record page: the favorite star beside the record name, none in the ⋯
expect(items.filter((text) => /favorites$/.test(text))).toEqual([]);
});

it('a phone draws the star beside the name, and its bottom bar\'s ⋯ holds no favorites entry', async () => {
it('a phone draws the star beside the name, and the top bar\'s ⋯ holds no favorites entry', async () => {
Object.defineProperty(window, 'innerWidth', { value: 390, configurable: true, writable: true });
const measure = HTMLElement.prototype.getBoundingClientRect;
vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) {
if (!this.hasAttribute('data-record-page-root')) return measure.call(this);
return { x: 0, y: 0, top: 0, left: 0, right: 390, bottom: 800, width: 390, height: 800, toJSON: () => ({}) } as DOMRect;
});
try {
await mountRecordPage();
// CONTROL: the phone face is drawn — its bottom bar holds the actions.
await waitFor(() => expect(document.querySelector('[data-record-action-bar] [role="toolbar"]')).toBeTruthy());
await mountRecordPage({ ready: '[data-record-phone-more] button[aria-label="More actions"]' });
// CONTROL: the phone face is drawn. This object declares no action of
// its own, so its bottom bar is drawn empty (and hidden), and the
// record's ⋯ is the one at the top bar's right end (objectstack#36151).
const topMore = await waitFor(() => {
const trigger = document.querySelector<HTMLElement>('[data-record-phone-more] button[aria-label="More actions"]');
expect(trigger).toBeTruthy();
return trigger!;
});
expect(document.querySelector('[data-record-action-bar]')!.childElementCount).toBe(0);
expect(screen.getAllByRole('button', { name: 'More actions' })).toEqual([topMore]);
const star = await waitFor(() => {
const [only, ...rest] = headerStars();
expect(rest).toHaveLength(0);
Expand All @@ -299,8 +308,9 @@ describe('record page: the favorite star beside the record name, none in the ⋯
fireEvent.click(star);
await waitFor(() => expect(stored()).toHaveLength(1));

const items = await openOverflow();
expect(items).toContain('Share');
const items = await openOverflow(topMore);
// CONTROL: the top ⋯ is open and holds the record's Edit and Share.
expect(items).toEqual(expect.arrayContaining(['Edit', 'Share']));
expect(items.filter((text) => /favorites$/.test(text))).toEqual([]);
} finally {
vi.restoreAllMocks();
Expand Down
Loading
Loading