From b7fc789d30b2827f8e9fa777b5f6ef9159fc002c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 13:00:00 +0000 Subject: [PATCH 1/3] test(console): pin the approvals inbox desktop table at 928 and 1102 px Claude-Session: https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6 Co-authored-by: Claude --- ...rovals-inbox-desktop-columns-37534.spec.ts | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts diff --git a/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts b/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts new file mode 100644 index 00000000000..9cea6a4a6ad --- /dev/null +++ b/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts @@ -0,0 +1,266 @@ +import { test, expect, type Page } from '@playwright/test'; +import { compile } from 'tailwindcss'; +import { readFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +import { fileURLToPath } from 'node:url'; +import path from 'node:path'; +import { uiRoot } from '../scripts/ui-root.mjs'; + +/** + * GEOMETRY pin for the approvals inbox's desktop table at common desktop + * widths (objectstack#37534): at a content width of 928 px and of 1102 px the + * record name is readable in full, and the right-pinned Approve / Reject + * column covers no other column. + * + * ## The defect + * + * The table pins its Approve / Reject column to the scroll box's right edge. + * Its text columns (Request, Requester) kept their whole label on one line, + * so their unbreakable width, the fixed Status / Submitted widths and the + * pinned buttons together were wider than a 928 px or 1102 px card. The + * table overflowed its box; at rest the pinned column then sat over the + * Submitted column, and the only column allowed to give, Record, was cut to + * about 110 px ("Polar Cargo – R…"). + * + * The text columns now wrap instead of holding the table open (Request, + * Record and Requester give their width back and break onto a second line), + * so the table fits its card from 928 px up and the pin covers nothing at + * rest. Below that the table still scrolls sideways under the pin, the + * console's list behaviour (objectui#12708 / #12816). A record name too long + * even for two lines is clamped, and the full text stays in its `title`. + * + * ## Why a Playwright spec and not a vitest test + * + * The reason `approvals-inbox-phone.spec.ts` gives: jsdom has no layout + * engine, so a width, an overlap or a cut read there is 0 and vacuous. + * + * ## What is real here and what is a fixture + * + * REAL, read out of the source files at run time: every class string on the + * table's path — the column heads, the cells, the Request / Record / + * Requester / Submitted cell bodies, the pinned-column classes, the inline + * buttons — from `ApprovalsInboxPage.tsx`; the base classes of the + * `@object-ui/components` primitives they render through (Table, TableHead, + * TableCell, TableRow, Button's `cva`, Badge, the overflow box and its pinned + * seam), merged the way `cn` merges them; and real Tailwind compiled from the + * installed `tailwindcss` for exactly those candidates. + * + * FIXTURE: the element tree, transcribed from the page's desktop face; the + * rows (names of the length the card measured, in English and zh-CN); and + * the width, set by a frame around the card, not by the console shell — 928 + * and 1102 px are the content widths the card measured. Fonts are Chromium's + * fallbacks: the assertions are overlap, overflow and cut, not pixels. + * + * Not vacuous: at a 700 px frame the same table is wider than its box, and + * the overlap and overflow readings report it. + */ + +const REPO_ROOT = uiRoot(); +const read = (rel: string) => readFileSync(path.join(REPO_ROOT, rel), 'utf8'); + +const PAGE_FILE = 'apps/console/src/pages/system/ApprovalsInboxPage.tsx'; +const UI = 'packages/components/src/ui'; +const OVERFLOW_HOOK = 'packages/components/src/custom/use-horizontal-overflow.ts'; +const OVERFLOW_BOX = 'packages/components/src/custom/horizontal-overflow.tsx'; +const SRC: Record = { + [PAGE_FILE]: read(PAGE_FILE), + [OVERFLOW_HOOK]: read(OVERFLOW_HOOK), + [OVERFLOW_BOX]: read(OVERFLOW_BOX), +}; +for (const f of ['button', 'table', 'badge', 'card']) SRC[`${UI}/${f}.tsx`] = read(`${UI}/${f}.tsx`); + +/** One capture out of a source file; a capture missing a token throws, so a drifted match cannot pass. */ +function grab(file: string, re: RegExp, mustContain: string[] = []): string { + const m = SRC[file].match(re); + if (!m) throw new Error(`${file}: nothing matched ${re}`); + const cls = m[1] ?? ''; + for (const token of mustContain) { + if (!cls.split(/\s+/).includes(token)) { + throw new Error(`${file}: ${re} matched "${cls}", which does not carry "${token}" — the extraction walked onto the wrong string.`); + } + } + return cls; +} + +const requireFromComponents = createRequire(path.join(REPO_ROOT, 'packages/components/package.json')); +const { twMerge } = requireFromComponents('tailwind-merge') as { twMerge: (...c: string[]) => string }; +const cn = (...parts: Array) => twMerge(parts.filter(Boolean).join(' ')); + +const BASE = { + tableBox: grab(`${UI}/table.tsx`, /
/, ['relative']), + boxInner: grab(OVERFLOW_BOX, /className=\{cn\('([^']+)', HOVER_SCROLLBAR_CLASSES/, ['overflow-x-auto']), + seam: grab(OVERFLOW_HOOK, /PINNED_RIGHT_SEAM_SHADOW_CLASSES =\s*'([^']+)'/, ['before:absolute']), +}; + +const P = PAGE_FILE; +const PAGE = { + pinned: grab(P, /const PINNED_ACTIONS_CLASSES = `([^`$]+)\$\{PINNED_RIGHT_SEAM_SHADOW_CLASSES\}`/, ['sticky']), + boxOuter: grab(P, //, []), + headCheckbox: grab(P, /\{tab === 'pending' && \(\s*/, ['w-10']), + headRequest: grab(P, /\{tr\('colRequest'/, []), + headRecord: grab(P, /\{tr\('colRecord'/, []), + headRequester: grab(P, /\{tr\('colRequester'/, []), + headStatus: grab(P, /\{tr\('colStatus'/, []), + headSubmitted: grab(P, /\{tr\('colWaiting'/, []), + headActions: grab(P, /\s*\s*\{isSystemSubmitter\(r\)/, []), + cellSubmitted: grab(P, /className=\{cn\('([^']+)', agingClass\(r, now\)\)\}/, ['text-xs']), + cellActions: grab(P, //, []), + requestLabel: grab(P, /function RequestCell[\s\S]*?
\s*
\{processLabel\(r\)\}/, ['font-medium']), + requestStep: grab(P, /function RequestCell[\s\S]*?\{processLabel\(r\)\}<\/div>\s*
/, ['text-xs']), + recordWrap: grab(P, /const title = r\.record_title[\s\S]*?return \(\s*
/, []), + recordLink: grab(P, /onClick=\{\(e\) => e\.stopPropagation\(\)\}\s*className="([^"]+)"\s*title=\{title\}/, ['text-sm']), + recordTitle: grab(P, /title=\{title\}\s*>\s*\{title\}<\/span>/, []), + recordMeta: grab(P, /<\/Link>\s*\)\}\s*
\s*\{objectDisplay\(r\)\}/, ['text-xs']), + requester: grab(P, /\s* onApprove/, ['h-7']), + reject: grab(P, /variant="ghost"\s+className="([^"]+)"\s+disabled=\{busy \|\| needsInputs\}\s+onClick=\{\(\) => onReject/, ['h-7']), +}; + +type Row = { process: string; step: string; record: string; meta: string; requester: string; status: string; ago: string; sla: string }; +type Labels = { request: string; record: string; requester: string; status: string; submitted: string; approve: string; reject: string }; + +/** Names of the length the card measured ("Polar Cargo – R…", 171 px of text in a 112 px cell). */ +const EN: { labels: Labels; rows: Row[] } = { + labels: { request: 'Request', record: 'Record', requester: 'Requester', status: 'Status', submitted: 'Submitted', approve: 'Approve', reject: 'Reject' }, + rows: [ + { process: 'Opportunity Discount Approval', step: 'Sales manager review', record: 'Polar Cargo – Renewal 2027', meta: 'Opportunity · $128,400', requester: 'Morgan Whitfield', status: 'Pending', ago: '3 days ago', sla: 'Due in 2 days' }, + { process: 'Expense Report Sign-off', step: 'Finance', record: 'EXP-2026-0042 Offsite travel', meta: 'Expense Report · $8,900', requester: 'Sam Submitter', status: 'Pending', ago: '5 hours ago', sla: '' }, + ], +}; +const ZH: { labels: Labels; rows: Row[] } = { + labels: { request: '审批事项', record: '记录', requester: '提交人', status: '状态', submitted: '提交时间', approve: '通过', reject: '拒绝' }, + rows: [ + { process: '商机折扣审批', step: '销售经理审核', record: 'Polar Cargo – Renewal 2027', meta: '商机 · ¥128,400', requester: '王小明', status: '待审批', ago: '3 天前', sla: '2 天后到期' }, + { process: '费用报销审批', step: '财务', record: '华东区 2026 年度渠道返利结算', meta: '费用报销 · ¥8,900', requester: '李华', status: '待审批', ago: '5 小时前', sla: '' }, + ], +}; + +const svg = (cls: string) => ``; + +function fixture({ labels, rows }: { labels: Labels; rows: Row[] }, frame: number): string { + const th = (cls: string, text: string, extra = '') => `${text}`; + const td = (cls: string, body: string, col: string) => `${body}`; + const pinnedHead = cn(BASE.head, PAGE.headActions, PAGE.pinned, BASE.seam, 'after:bg-muted/50'); + const pinnedCell = cn(BASE.cell, PAGE.cellActions, PAGE.pinned, BASE.seam, 'after:bg-accent/50'); + const btn = (extra: string, label: string) => + ``; + const body = rows.map((r) => + `` + + td('w-10', '', 'checkbox') + + td(PAGE.cellRequest, `
${r.process}
${r.step}
`, 'request') + + td(PAGE.cellRecord, + ``, 'record') + + td(PAGE.cellRequester, `
${svg('h-3.5 w-3.5 shrink-0')}${r.requester}
`, 'requester') + + td('', `${r.status}`, 'status') + + td(PAGE.cellSubmitted, `${svg('h-3 w-3 inline mr-1')}${r.ago}${r.sla ? `
${r.sla}
` : ''}`, 'submitted') + + `
${btn(PAGE.approve, labels.approve)}${btn(PAGE.reject, labels.reject)}
` + + ``, + ).join(''); + return ( + `
` + + `
` + + `
` + + `
` + + `` + + th(PAGE.headCheckbox, '') + + th(PAGE.headRequest, labels.request) + + th(PAGE.headRecord, labels.record) + + th(PAGE.headRequester, labels.requester) + + th(PAGE.headStatus, labels.status) + + th(PAGE.headSubmitted, labels.submitted, ' data-col="submitted"') + + `` + + `${body}
` + ); +} + +let css = ''; +test.beforeAll(async () => { + const twEntry = fileURLToPath(import.meta.resolve('tailwindcss/index.css')); + const compiler = await compile('@import "tailwindcss";', { + base: path.dirname(twEntry), + loadStylesheet: async (id: string, base: string) => { + const file = id === 'tailwindcss' ? twEntry : path.resolve(base, id); + return { path: file, base: path.dirname(file), content: readFileSync(file, 'utf8') }; + }, + }); + const candidates = [fixture(EN, 1000), fixture(ZH, 1000)].join(' ').match(/class="([^"]+)"/g) ?? []; + css = compiler.build(candidates.flatMap((c) => c.slice(7, -1).split(/\s+/)).filter(Boolean)); + if (!css.includes('position: sticky')) throw new Error('Tailwind produced no `sticky` rule — the pinned column would be inert.'); +}); + +type Reading = { + scroller: { client: number; scroll: number }; + /** Right edge of each row's (and the head's) Submitted cell against the left edge of its pinned cell. */ + overlaps: { submittedRight: number; pinnedLeft: number }[]; + records: { text: string; cut: boolean; title: string | null; lines: number }[]; +}; + +async function measure(page: Page, locale: typeof EN, frame: number): Promise { + await page.setViewportSize({ width: frame + 200, height: 900 }); + await page.setContent(`${fixture(locale, frame)}`, { waitUntil: 'load' }); + await page.evaluate(() => document.fonts?.ready); + return page.evaluate(() => { + const round = (n: number) => Math.round(n * 100) / 100; + const scroller = document.getElementById('scroller')!; + const overlaps = Array.from(document.querySelectorAll('tr')).map((tr) => { + const s = tr.querySelector('[data-col="submitted"]')!.getBoundingClientRect(); + const a = tr.querySelector('[data-col="actions"]')!.getBoundingClientRect(); + return { submittedRight: round(s.right), pinnedLeft: round(a.left) }; + }); + const records = Array.from(document.querySelectorAll('[data-record-text]')).map((el) => { + const lh = parseFloat(getComputedStyle(el).lineHeight) || 20; + return { + text: el.textContent ?? '', + cut: el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1, + title: el.closest('[title]')?.getAttribute('title') ?? null, + lines: Math.round(el.getBoundingClientRect().height / lh), + }; + }); + return { scroller: { client: scroller.clientWidth, scroll: scroller.scrollWidth }, overlaps, records }; + }); +} + +test.describe('Approvals inbox desktop table at common desktop widths (objectstack#37534)', () => { + for (const [name, locale] of [['en', EN], ['zh-CN', ZH]] as const) { + for (const frame of [928, 1102]) { + test(`${name} at ${frame} px: the pinned column covers nothing and record names read in full`, async ({ page }) => { + const r = await measure(page, locale, frame); + test.info().annotations.push({ type: 'reading', description: JSON.stringify(r) }); + expect(r.scroller.scroll, `the table is ${r.scroller.scroll}px wide in a ${r.scroller.client}px box`).toBeLessThanOrEqual(r.scroller.client); + expect(r.overlaps.length).toBe(locale.rows.length + 1); + for (const o of r.overlaps) { + expect(o.pinnedLeft, `the pinned column starts at ${o.pinnedLeft}, left of Submitted's right edge ${o.submittedRight}`).toBeGreaterThanOrEqual(o.submittedRight - 0.5); + } + expect(r.records.length).toBe(locale.rows.length); + for (const rec of r.records) { + expect(rec.cut, `"${rec.text}" is cut (${rec.lines} line(s))`).toBe(false); + expect(rec.title, `"${rec.text}" carries no tooltip`).toBe(rec.text); + } + }); + } + } + + test('not vacuous: at 700 px the same table is wider than its box and the pin covers Submitted', async ({ page }) => { + const r = await measure(page, EN, 700); + expect(r.scroller.scroll).toBeGreaterThan(r.scroller.client); + expect(r.overlaps.some((o) => o.pinnedLeft < o.submittedRight - 0.5)).toBe(true); + }); +}); From fc4e810d0a6124699403d0089562def245b21412 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 13:02:10 +0000 Subject: [PATCH 2/3] fix(console): the approvals inbox's text columns wrap so the pinned Approve / Reject column covers nothing at common desktop widths Claude-Session: https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6 Co-authored-by: Claude --- ...valsInboxPage.pinnedActions-12816.test.tsx | 11 +++--- .../src/pages/system/ApprovalsInboxPage.tsx | 34 +++++++++++++------ ...rovals-inbox-desktop-columns-37534.spec.ts | 10 ++++++ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/ui/apps/console/src/pages/system/ApprovalsInboxPage.pinnedActions-12816.test.tsx b/ui/apps/console/src/pages/system/ApprovalsInboxPage.pinnedActions-12816.test.tsx index bc726d8483c..98f47a87f6f 100644 --- a/ui/apps/console/src/pages/system/ApprovalsInboxPage.pinnedActions-12816.test.tsx +++ b/ui/apps/console/src/pages/system/ApprovalsInboxPage.pinnedActions-12816.test.tsx @@ -2,7 +2,7 @@ /** * Approvals Inbox — the Approve / Reject column is pinned right and a long - * record title truncates (objectui#12816). + * record title is clamped (objectui#12816). * * Measured at 1024 px (HotCRM, three account approvals titled like * "ACC-000011 - Contoso Pharmaceuticals and Life Sciences Group"): the table @@ -12,7 +12,8 @@ * past the card's right edge. * * - The Record cells are `max-w-0`: the title no longer sizes its column, so - * it truncates, its full text in `title`. The header keeps a floor. + * it wraps to two lines and is then clamped, its full text in `title`. The + * header keeps a floor. * - The Approve / Reject cells are pinned right in the header and every row, * with the shared seam shadow (`PINNED_RIGHT_SEAM_SHADOW_CLASSES`), inside * the overflow box's `seam="pinned"` mode. @@ -184,14 +185,16 @@ describe('Approvals Inbox — pinned Approve / Reject, truncating Record (object } }); - it('truncates a 60-character record title instead of letting it size the column', async () => { + it('clamps a 60-character record title instead of letting it size the column', async () => { const box = await renderAt718(); expect(LONG).toHaveLength(60); const link = screen.getByRole('link', { name: LONG }); // The link is still the whole title, and carries it in full. expect(link).toHaveAttribute('title', LONG); expect(link).toHaveTextContent(LONG); - expect(link.querySelector('span')).toHaveClass('truncate'); + // objectstack#37534: two lines, then clamped (the geometry is measured in + // `e2e/approvals-inbox-desktop-columns-37534.spec.ts`). + expect(link.querySelector('span')).toHaveClass('line-clamp-2'); // The cell takes the title's unbreakable width out of the table's column // sizing, so the table does not widen for it; the header keeps a floor. expect(link.closest('td')).toHaveClass('max-w-0'); diff --git a/ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx b/ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx index a729e1db98b..527f37f4d2b 100644 --- a/ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx +++ b/ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx @@ -396,10 +396,13 @@ type Translate = (key: string, defaultValue: string, opts?: Record -
{processLabel(r)}
-
+
{processLabel(r)}
+
{stepLabel(r) || '—'} {(r.round ?? 1) > 1 && ( @@ -604,17 +607,17 @@ function RecordCell({ r, href, linkState, figureField, deadLabel, unresolvableLa ) : unresolvableLabel !== null ? ( ) : href === null ? ( -
{title}
+
{title}
) : ( e.stopPropagation()} - className="inline-flex items-center gap-1 text-sm hover:underline truncate max-w-full" + className="inline-flex items-start gap-1 text-sm hover:underline max-w-full" title={title} > - {title} - + {title} + )}
@@ -1676,6 +1679,14 @@ function ApprovalsQueue() { widths so they never crowd — instead of the browser spreading five auto columns evenly and leaving 审批事项 over-wide next to a cramped 状态. */} + {/* objectstack#37534 — the three text columns (Request, + Record, Requester) WRAP instead of holding one line, so + none of them sets a minimum width the card cannot give: + from a 928 px card up the table fits, and the pinned + Approve / Reject column covers no other column at rest. + Narrower, the table scrolls under the pin (#12708). + `e2e/approvals-inbox-desktop-columns-37534.spec.ts` + measures it in Chromium. */} {tr('colRequest', 'Request')} {/* objectui#12816 — the Record cells are `max-w-0` (below), so this floor is the column's only minimum: enough to @@ -1710,9 +1721,10 @@ function ApprovalsQueue() { )} {/* objectui#12816 — `max-w-0` takes the record title's - unbreakable width out of the auto-layout table's - column sizing, so a long title truncates (full text - in its `title`) instead of widening the table. */} + width out of the auto-layout table's column sizing, + so a long title wraps to two lines and is then + clamped (full text in its `title`, objectstack#37534) + instead of widening the table. */} {tr('flowOrigin', 'Flow-initiated')}
) : ( -
+
- {submitterDisplay(r)} + {submitterDisplay(r)} {tab !== 'submitted' && r.viewer?.is_submitter === true && ( )} diff --git a/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts b/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts index 9cea6a4a6ad..b8bc292742f 100644 --- a/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts +++ b/ui/e2e/approvals-inbox-desktop-columns-37534.spec.ts @@ -258,6 +258,16 @@ test.describe('Approvals inbox desktop table at common desktop widths (objectsta } } + test('a record name too long for two lines is clamped, keeps its full text as a tooltip, and widens nothing', async ({ page }) => { + const long = 'ACC-000011 - Contoso Pharmaceuticals and Life Sciences Group Holdings'; + const r = await measure(page, { labels: EN.labels, rows: [{ ...EN.rows[0], record: long }, EN.rows[1]] }, 928); + expect(r.scroller.scroll).toBeLessThanOrEqual(r.scroller.client); + const rec = r.records.find((x) => x.text === long)!; + expect(rec.cut, 'the long name is not clamped, so this case measures nothing').toBe(true); + expect(rec.lines).toBe(2); + expect(rec.title).toBe(long); + }); + test('not vacuous: at 700 px the same table is wider than its box and the pin covers Submitted', async ({ page }) => { const r = await measure(page, EN, 700); expect(r.scroller.scroll).toBeGreaterThan(r.scroller.client); From 8d4d42e808e50772c88bdbf5a3cd778d1c2e0170 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 13:02:29 +0000 Subject: [PATCH 3/3] chore(changeset): approvals inbox text columns wrap Claude-Session: https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6 Co-authored-by: Claude --- .changeset/37534-approvals-inbox-columns-wrap.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .changeset/37534-approvals-inbox-columns-wrap.md diff --git a/.changeset/37534-approvals-inbox-columns-wrap.md b/.changeset/37534-approvals-inbox-columns-wrap.md new file mode 100644 index 00000000000..d9f66f4b992 --- /dev/null +++ b/.changeset/37534-approvals-inbox-columns-wrap.md @@ -0,0 +1,12 @@ +--- +'@object-ui/console': patch +--- + +fix(console): the approvals inbox's pinned Approve / Reject column no longer covers the Submitted column, and record names read in full at common desktop widths + +Clause-②: no +Metadata-protocol: none + +In the approvals inbox's desktop table the Request, Record and Requester columns now wrap their text instead of holding it on one line. Before, a one-line request label and requester name set minimum widths that, with the fixed Status and Submitted widths and the pinned Approve / Reject buttons, were wider than a 928 px or 1102 px card: the table overflowed, the pinned column sat over the Submitted column at rest, and the record name was cut to a few words. + +From a 928 px card up the table now fits, so the pinned column covers no other column; narrower, the table still scrolls sideways under the pinned column. A record name wraps to two lines and is clamped after that, with its full text in the hover tooltip as before. A requester's "You submitted this" badge moves under the name when the column is narrow. Nothing to migrate.