Skip to content

Commit dda665f

Browse files
fix(grid): a narrowed list keeps every data cell clear of its fixed columns and shows its scrollbar (#35552)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg6v19uPsX6gX42G8tGcvvzb)_ Fixes #35446 repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户看到的变化:AI 助手打开、窗口变小或记录抽屉打开、列表放不下时,每行的「⋮」移到名称列旁边一起冻结,不再压住金额等数据列;其余列横向滚动,底部滚动条一直可见;页头不显示说明文字,「导入」收进「⋯」,标题不再被截断。 - 为什么:右侧面板打开时,列表里的金额被「操作」列遮住,后面几列看不到,也没有任何提示。 - 如果判断错:只影响窄宽度下列表和页头的显示,不隐藏任何列、不改列配置,其他页面的页头不变;够宽时和原来一样。 - 需要您做的:无,席位落地。 ## What changes **Row actions column (plugin-grid).** `useInlineRowActionFold` already folded inline primary row actions into the row's "⋮" menu while the table overflowed its scroll box. It now also answers `actionsFrozen`. While the table, menu-only, is still wider than its box, `ObjectGrid` draws the auto-pinned Actions column right after the frozen columns and counts it into `frozenColumns`, instead of pinning it to the right edge. The frozen zone never covers a column at rest, so every data column scrolls and none is covered. The column goes back to the right edge once the box is as wide as the table was when it moved. The move swaps the frozen zone's edge rule, which changes the width by a pixel or two, so the way back reads the width recorded before the move and cannot flip-flop. A frozen table that fits with more than 4 px to spare also goes back, so a table that shrank while frozen is not held there. The placement survives a data refresh. Option picked, of the three the dispatch named: **join the frozen zone**. The card measured an opaque right-pinned cell over a clipped data cell (the geometry pin's overlap reading is 67.9 px on `origin/main`). A "⋮" shown on row hover would still cover a cell while it shows, and has no hover on touch. In the frozen zone the trigger is always visible, one click away, and covers nothing. Not changed: an author's own `pinned: 'right'` columns (the author's layout, per the card's 「不改列表的列配置」), the grouped list (it disables frozen columns in its shared scroller), and a list whose table fits its box (the CONTROL cases). **Scrollbar (components `data-table`).** While the table is wider than its box (`scrollsSideways`, read at mount and on resize), the scroll box draws its scrollbar at rest in the muted foreground. A table that fits keeps the shared hover-only bar of objectui#12708. This is the approach of the Studio Records tab fix (`RECORDS_SCROLLBAR_VISIBLE`) moved into the table, and applied only while the table actually scrolls sideways. **List header (app-shell).** `PageHeader` gains an opt-in `compactBelow` (px of the header's own width). Below it, the one-row header does not draw the description, draws `foldedActions`, and drops the title's 60 % cap, which exists only to leave room for the description. Setup's two-line posture ignores it. Only `ObjectViewPageHeader` passes it (768, the `md` breakpoint read against the header's own width), so every other `PageHeader` page is unchanged. At 768 px and above, the list header is exactly as before, including the content-driven fold of objectui#12705. ## Tests - `ui/e2e/list-narrow-pinned-columns-35446.spec.ts` (new Playwright geometry pin; the real `ObjectGrid` is bundled from source, styled with real Tailwind). Case: a 699 px main area (the card's AI-panel case), with and without an inline primary action. Checks: no fixed cell overlaps a data cell in the header row or the first body row; every data cell in view answers `elementFromPoint` at its centre; the "⋮" column sticks left after `name`; the scrollbar colour at rest is not transparent; the last column answers at its centre after a scroll to the end; Archive runs from the row menu. CONTROL at 1184 px: nothing moves and nothing is covered, and the bar stays hover-only. CONTROL at 699 px with columns that fit: Actions stays on the right. - `ui/e2e/list-header-narrow-35446.spec.ts` (new; the real `ObjectViewPageHeader` with the actions its page builds, `useObjectViewHeaderChrome`, and the `action:bar` renderer). At 699 px: compact form, no description, no Import button in the row, New drawn, nothing spills past the header, the title is not cut, and Import runs from the 「⋯」 menu. CONTROL at 1184 px: description drawn, Import is a button, the actions are not folded. - `PageHeader.actionsFold-12705.test.tsx`: new top-level describe for `compactBelow`. At 700 px: no description, folded actions, Import runs from the 「⋯」, title not capped. It follows width both ways (1000 px gives the full row, 700 px compact again). CONTROL: no `compactBelow` keeps the description, the three actions and the cap. CONTROL: Setup ignores it. - `row-action-sticky.test.tsx` and `data-table-scroll-shadow-12463.test.tsx`: new top-level describes, as in the first round. - Existing pin updated: `related-list-pinned-actions-width.spec.ts`, the case where the drawer overflows even menu-only, now asserts the Actions column has left the right edge. The jsdom pins of the right-pinned shape are unchanged and green. <details><summary>CI red on ca569b4, root cause and fix: the header pin's title-cut assertion</summary> `Build & E2E UI` failed both attempts on the AI-panel header case, at the assertion that the title is not cut. CI reading: `compact: true`, `folded: true`, `spill: []`, `titleClipped: true`. The pin's measure is right; the header was wrong. In the compact form the title kept the one-row header's 60 % cap (`sm:max-w-[60%]`), which leaves room for a description the compact form no longer draws. With CI's fonts, the title 「Opportunities / Open opportunities」 is just wider than 60 % of the 521 px text block (312 px), so it was cut while about 200 px of the row stood empty. Locally the fallback font measured 291 px and passed, which is why the first local run was green. Reproduced locally by making the fixture's view label long enough to exceed the cap in any font (`Open opportunities this quarter`). Red before the fix: `title.box 312, content 391, block 521, maxWidth 60%`, "the title is cut". The fix drops the cap in the compact form only. Green after the fix: `box 391, content 391, maxWidth 100%`. The full-width CONTROL keeps `maxWidth 60%`. The assertion is unchanged; the pin now also reports the title's box, content, block and max-width. Ablation of the fix (cap restored in compact, anchor 1 → 0, replacement 0 → 1): red with the same reading, restored blob == HEAD. </details> <details><summary>Readings and ablations</summary> Grid pin on `origin/main` code at 699 px: Actions pinned right, overlap 67.9 px over `expected_revenue`, scrollbar `rgba(0, 0, 0, 0)` (2 failed, 2 CONTROLs passed). This branch: `order [name, _actions, account, …, close_date]`, `frozen [name, _actions]`, overlap 0, `covered []`, scrollbar `rgb(100, 116, 139)`, `scrollWidth` 977 before and after the move. Ablations, each through `scripts/ablation-replace.mjs`, restored with blob == HEAD and `git diff HEAD` empty: - `actionsInFrozenZone` forced false: grid pin red (overlap 67.9 px), `row-action-sticky` 2 failed. - at-rest scrollbar forced off: grid pin red ("the scrollbar is transparent at rest"), the 12463 file 1 failed. - the list page's `compactBelow` opt-in removed: header pin red ("the list header did not take its compact form"). The reading shows that on `origin/main` the 699 px header already folds Import (`folded: true`) but keeps its description. - the description guard in `PageHeader` removed: header pin red ("the description is still drawn"), the PageHeader harness 2 failed. - the compact title cap restored: header pin red ("the title is cut"). - Two attempts were refused by the tool as no-ops before running, because the replacement was a substring of the anchor. Each was redone with a distinct replacement. </details> ## Acceptance notes - Premise readings on `origin/main`: the name column was already frozen and the table already scrolled inside its own box; the header already folded Import into the 「⋯」 once its text would clip (objectui#12705). Still true were the Actions column over a data column at rest, the transparent scrollbar at rest, and the description drawn at a narrow width. - The grouped list (a `groupBy` view) keeps its right-pinned Actions column over the shared scroller. Frozen columns are disabled there by design, and it is out of this round (not reproduced in a browser). - Headless Chromium draws no scrollbar, so the grid pin reads the scrollbar's computed colour, not the room it takes. ## Verification <details><summary>Local runs</summary> - Round 1 (head 8e8ce3d): `vitest run packages/plugin-grid/` plus the 76 components test files that name the data table: 364 files passed, 1 skipped; 3045 tests passed. `vitest run scripts/` (ui): 171 files passed, 5092 tests passed. Type-check of components and plugin-grid: exit 0. - Round 2: both new e2e specs plus the related-list spec, green on the final head. PageHeader harness: 11 passed. Under the shared lock: `@object-ui/app-shell` type-check and `pnpm check:type-check-debt`, exit 0 (`VERDICT command-exit 0`). - The derived gate families and the targeted app-shell tests on the final head are in the report on #35446. - `overlap-check` clean before each push of this round. `Test UI` and the rest of the farm run in CI. </details> --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 83a79e6 commit dda665f

12 files changed

Lines changed: 1200 additions & 40 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/plugin-grid': patch
3+
'@object-ui/components': patch
4+
'@object-ui/app-shell': patch
5+
---
6+
7+
fix(grid): a list in a narrowed main area keeps every data cell clear of its fixed columns, shows its horizontal scrollbar, and draws a short header
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
- **Row actions column.** While a list's table is wider than its box (the AI panel docked, a small window, the record drawer open), the row actions column (the row's "⋮") is drawn right after the frozen name column and frozen with it, instead of pinned to the right edge, where it covered the data column reaching that edge (an amount cut to 「¥94,0」). Every data column then scrolls sideways under the frozen columns, and none is covered at rest. Once the box is wide enough for the whole table again, the column goes back to the right edge, so a list that fits looks as before. Inline primary row actions still fold into the "⋮" menu first, as before. Columns an author pinned to the right stay where the author put them; the grouped list is unchanged.
13+
- **Horizontal scrollbar.** A table wider than its box draws its scrollbar at rest instead of only while the pointer is over it, so columns out of view are announced. A table that fits keeps the scrollbar that shows on hover.
14+
- **List header.** While the list page's header is narrower than 768 px, it draws no description, and Import moves into the 「⋯」 menu beside New. A wider header is unchanged. This is opt-in: the console `PageHeader` gains `compactBelow` (a width in px; below it the one-row header drops its description and draws its folded actions), which only the list page passes, so other pages that use `PageHeader` are unchanged. Setup's two-line header ignores it.
15+
- No column is hidden and no column configuration changes.

‎ui/e2e/list-header-narrow-35446.spec.ts‎

Lines changed: 382 additions & 0 deletions
Large diffs are not rendered by default.

‎ui/e2e/list-narrow-pinned-columns-35446.spec.ts‎

Lines changed: 436 additions & 0 deletions
Large diffs are not rendered by default.

‎ui/e2e/related-list-pinned-actions-width.spec.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,11 @@ test.describe('enlarged related list in a record drawer — the pinned Actions c
397397
report(testInfo, c, r);
398398
expect(r.folded).toBe(true);
399399
expect(r.inlineButtons).toBe(0);
400-
// Still wider than the drawer: the pinned column sits at the box's edge
401-
// over whichever column scrolls under it, as on any list that scrolls
402-
// sideways. A scroll to the end shows Status whole.
400+
// Still wider than the drawer: the Actions column leaves the right edge
401+
// for the frozen zone beside the name column (objectstack#35446), and a
402+
// scroll to the end shows Status whole.
403403
expect(r.box.scrollWidth).toBeGreaterThan(r.box.clientWidth);
404+
expect(r.actions.left, 'the Actions column still sits at the right edge').toBeLessThan(r.box.clientWidth / 2);
404405
const end = await page.evaluate(async () => {
405406
const box = document.querySelector<HTMLElement>('[data-table-scroll-box]')!;
406407
box.scrollLeft = box.scrollWidth;

‎ui/packages/app-shell/src/layout/PageHeader.tsx‎

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
* the header is too narrow for `actions` and its text, it draws that instead,
3636
* so the actions fold before the title or the description is cut:
3737
* [icon] Title [kind] | the whole description [refresh] [primary] [⋯]
38+
*
39+
* The compact form — a page may opt in with `compactBelow` (objectstack#35446):
40+
* while the one-row header is narrower than that, it drops the description and
41+
* draws `foldedActions` whatever the text needs, so a main area narrowed by a
42+
* docked panel, a small window or the record drawer gets a short header row:
43+
* [icon] Title [kind] [refresh] [primary] [⋯]
3844
*/
3945

4046
import * as React from 'react';
@@ -140,6 +146,17 @@ export interface ConsolePageHeaderProps {
140146
* trade the page's actions for its description.
141147
*/
142148
foldedActions?: React.ReactNode;
149+
/**
150+
* Opt-in compact form for a narrow header (objectstack#35446): while the
151+
* one-row header is narrower than this many pixels, the description (and
152+
* the hairline before it) is not drawn and `foldedActions`, when given, is
153+
* drawn in place of `actions`. At this width and above the header behaves
154+
* exactly as without it. Read from the header's own width, never the
155+
* viewport's, so any narrowing of the main area counts. Setup's posture,
156+
* whose description sits on its own line, ignores it. A page that passes
157+
* nothing keeps today's header at every width.
158+
*/
159+
compactBelow?: number;
143160
/**
144161
* CSS color used to tint the top hairline, icon chip background, and
145162
* icon stroke. Defaults to the Shadcn `--primary` token so the header
@@ -184,6 +201,7 @@ export function PageHeader({
184201
refresh,
185202
actions,
186203
foldedActions,
204+
compactBelow,
187205
accentColor,
188206
sticky = false,
189207
className,
@@ -198,8 +216,12 @@ export function PageHeader({
198216

199217
// objectui#12705 — the actions fold before the text is cut.
200218
const canFold = foldedActions != null && foldedActions !== false;
201-
const { rootRef, textRef, descriptionRef, clusterRef, folded } = useActionsFold(canFold, setup);
202-
const drawnActions = canFold && folded ? foldedActions : actions;
219+
const { rootRef, textRef, descriptionRef, clusterRef, folded, compact } = useActionsFold(
220+
canFold,
221+
setup,
222+
setup ? undefined : compactBelow,
223+
);
224+
const drawnActions = canFold && (folded || compact) ? foldedActions : actions;
203225

204226
const refreshButton = refresh ? (
205227
<Button
@@ -222,7 +244,7 @@ export function PageHeader({
222244
ref={clusterRef}
223245
className="flex items-center gap-1.5 sm:gap-2 shrink-0"
224246
data-testid="page-header-actions"
225-
data-folded={canFold ? String(folded) : undefined}
247+
data-folded={canFold ? String(folded || compact) : undefined}
226248
>
227249
{refreshButton}
228250
{drawnActions}
@@ -241,6 +263,7 @@ export function PageHeader({
241263
)}
242264
data-testid={testId ?? 'page-header'}
243265
data-posture={setup ? 'setup' : 'row'}
266+
data-compact={compact ? 'true' : undefined}
244267
>
245268
{/* Accent hairline — a 2px gradient strip that fades to transparent at
246269
both edges. Picks up the app's accent color, or the default primary
@@ -290,11 +313,14 @@ export function PageHeader({
290313
`border-box` a min-height there would count that row's padding. */}
291314
<div ref={textRef} className="flex items-center gap-2.5 min-w-0 flex-1 min-h-9">
292315
{icon && <IconTile size="row">{icon}</IconTile>}
293-
<h1 className="min-w-0 max-w-full sm:max-w-[60%] shrink-0 text-base sm:text-lg font-semibold tracking-tight text-foreground truncate leading-tight">
316+
{/* The 60 % cap keeps room for the description beside the title;
317+
the compact form draws none, so its title takes the whole row
318+
(objectstack#35446). */}
319+
<h1 className={cn('min-w-0 max-w-full shrink-0 text-base sm:text-lg font-semibold tracking-tight text-foreground truncate leading-tight', !compact && 'sm:max-w-[60%]')}>
294320
{title}
295321
</h1>
296322
{badge}
297-
{(subtitle || breadcrumb) && (
323+
{(subtitle || breadcrumb) && !compact && (
298324
<>
299325
<span aria-hidden="true" className="hidden sm:block h-4 w-px shrink-0 bg-border" />
300326
<p ref={descriptionRef} className="hidden sm:block min-w-0 flex-1 truncate text-sm text-muted-foreground">
@@ -327,8 +353,12 @@ export function PageHeader({
327353
* Without layout (no `ResizeObserver`, every width 0) nothing ever overflows
328354
* and the header stays unfolded.
329355
*/
330-
function useActionsFold(canFold: boolean, setup: boolean) {
356+
function useActionsFold(canFold: boolean, setup: boolean, compactBelow: number | undefined) {
331357
const rootRef = React.useRef<HTMLDivElement>(null);
358+
// objectstack#35446 — the opt-in compact form, read from the header's own
359+
// width. Without layout (width 0) the header is never compact.
360+
const [compact, setCompact] = React.useState(false);
361+
const compactRef = React.useRef(false);
332362
const textRef = React.useRef<HTMLDivElement>(null);
333363
const descriptionRef = React.useRef<HTMLParagraphElement>(null);
334364
const clusterRef = React.useRef<HTMLDivElement>(null);
@@ -340,6 +370,18 @@ function useActionsFold(canFold: boolean, setup: boolean) {
340370
// observer below never keys on a callback's identity (AGENTS.md #10).
341371
const measureRef = React.useRef<() => void>(() => {});
342372
const measure = () => {
373+
const rootWidth = rootRef.current?.getBoundingClientRect().width ?? 0;
374+
const nextCompact = compactBelow !== undefined && rootWidth > 0 && rootWidth < compactBelow;
375+
// The compact face is decided by width alone. The content fold below reads
376+
// the full face, so it is measured only once that face is drawn: never
377+
// while the compact one is, nor in the pass that switches between them
378+
// (the render that follows measures again).
379+
if (nextCompact !== compactRef.current) {
380+
compactRef.current = nextCompact;
381+
setCompact(nextCompact);
382+
return;
383+
}
384+
if (nextCompact) return;
343385
if (!canFold) {
344386
// A page that stops offering the fold starts unfolded when it offers it
345387
// again.
@@ -372,16 +414,17 @@ function useActionsFold(canFold: boolean, setup: boolean) {
372414
measure();
373415
});
374416

417+
const observes = canFold || compactBelow !== undefined;
375418
React.useEffect(() => {
376419
const root = rootRef.current;
377-
if (!canFold || !root || typeof ResizeObserver === 'undefined') return;
420+
if (!observes || !root || typeof ResizeObserver === 'undefined') return;
378421
const observer = new ResizeObserver(() => measureRef.current());
379422
observer.observe(root);
380423
if (clusterRef.current) observer.observe(clusterRef.current);
381424
return () => observer.disconnect();
382-
}, [canFold]);
425+
}, [observes]);
383426

384-
return { rootRef, textRef, descriptionRef, clusterRef, folded: canFold && folded };
427+
return { rootRef, textRef, descriptionRef, clusterRef, folded: canFold && folded, compact };
385428
}
386429

387430
/**

‎ui/packages/app-shell/src/layout/__tests__/PageHeader.actionsFold-12705.test.tsx‎

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ function installLayout() {
5757
};
5858
const rectWidth = (el: Element): number => {
5959
if (el.matches('[data-testid="page-header-actions"]')) return clusterWidth(el);
60+
// The header's own width, read by the opt-in compact form (objectstack#35446).
61+
if (el.matches('[data-testid="page-header"]')) return headerWidth;
6062
if (!el.closest('[data-testid="page-header"]')) return 0;
6163
if (el.tagName === 'H1') return (el.textContent ?? '').length * 10;
6264
if (el.matches('span[aria-hidden="true"]')) return 1;
@@ -166,7 +168,12 @@ function PageMenu({ children }: { children?: React.ReactNode }) {
166168
);
167169
}
168170

169-
function mount({ appName = 'crm', fold = true, onImport = vi.fn() } = {}) {
171+
function mount({
172+
appName = 'crm',
173+
fold = true,
174+
onImport = vi.fn(),
175+
compactBelow,
176+
}: { appName?: string; fold?: boolean; onImport?: () => void; compactBelow?: number } = {}) {
170177
installLayout();
171178
render(
172179
<MemoryRouter initialEntries={[`/apps/${appName}/page`]}>
@@ -179,6 +186,7 @@ function mount({ appName = 'crm', fold = true, onImport = vi.fn() } = {}) {
179186
subtitle={DESCRIPTION}
180187
actions={<Actions onImport={onImport} />}
181188
foldedActions={fold ? <FoldedActions onImport={onImport} /> : undefined}
189+
compactBelow={compactBelow}
182190
/>
183191
}
184192
/>
@@ -268,3 +276,55 @@ describe('the console page header folds its actions before its text (objectui#12
268276
expect(labelled()).toEqual(['New', 'Import', 'Update Stage']);
269277
});
270278
});
279+
280+
/**
281+
* objectstack#35446 — the opt-in compact form: below `compactBelow` px of its
282+
* own width the one-row header drops its description and draws the folded
283+
* actions, even where the content fold above would keep them (700 px fits all
284+
* three actions beside the description in this model).
285+
*/
286+
describe('the console page header’s opt-in compact form (objectstack#35446)', () => {
287+
it('a 700 px header with compactBelow 768 draws no description and folds Import into the ⋯', () => {
288+
headerWidth = 700;
289+
const onImport = vi.fn();
290+
const { header, cluster, labelled } = mount({ compactBelow: 768, onImport });
291+
expect(header.getAttribute('data-compact')).toBe('true');
292+
expect(within(header).queryByText(DESCRIPTION)).toBeNull();
293+
// No description to share the row with: the title is not capped to 60 % of it.
294+
expect(header.querySelector('h1')!.className).not.toContain('sm:max-w-[60%]');
295+
expect(cluster.getAttribute('data-folded')).toBe('true');
296+
expect(labelled()).toEqual(['New']);
297+
fireEvent.pointerDown(within(cluster).getByTestId('more'), { button: 0, pointerType: 'mouse' });
298+
fireEvent.click(screen.getByTestId('folded-import'));
299+
expect(onImport).toHaveBeenCalledTimes(1);
300+
});
301+
302+
it('follows the header’s width both ways: the full row at 1000 px, compact again at 700 px', () => {
303+
headerWidth = 700;
304+
const { header, labelled } = mount({ compactBelow: 768 });
305+
expect(labelled()).toEqual(['New']);
306+
resizeTo(1000);
307+
expect(header.getAttribute('data-compact')).toBeNull();
308+
expect(within(header).getByText(DESCRIPTION)).toBeTruthy();
309+
expect(labelled()).toEqual(['New', 'Import', 'Update Stage']);
310+
resizeTo(700);
311+
expect(within(header).queryByText(DESCRIPTION)).toBeNull();
312+
expect(labelled()).toEqual(['New']);
313+
});
314+
315+
it('CONTROL — without compactBelow a 700 px header keeps its description and all three actions', () => {
316+
headerWidth = 700;
317+
const { header, labelled } = mount();
318+
expect(header.getAttribute('data-compact')).toBeNull();
319+
expect(within(header).getByText(DESCRIPTION)).toBeTruthy();
320+
expect(header.querySelector('h1')!.className).toContain('sm:max-w-[60%]');
321+
expect(labelled()).toEqual(['New', 'Import', 'Update Stage']);
322+
});
323+
324+
it('CONTROL — the Setup posture ignores compactBelow; its description is its own line', () => {
325+
headerWidth = 600;
326+
const { header } = mount({ appName: 'setup', compactBelow: 768 });
327+
expect(header.getAttribute('data-compact')).toBeNull();
328+
expect(within(header).getByTestId('page-header-description').textContent).toBe(DESCRIPTION);
329+
});
330+
});

‎ui/packages/app-shell/src/views/objectViewPageHeader.tsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ import type { useObjectViewHeaderToolbar } from './objectViewHeaderToolbar.js';
3232
import type { useObjectViewHeaderChrome } from './objectViewHeaderChrome.js';
3333
import type { ConsoleObjectViewProps } from './ObjectView.js';
3434

35+
/**
36+
* objectstack#35446 — the list header's width under which it takes
37+
* `PageHeader`'s compact form: no description, and the folded actions (New
38+
* labelled, Import and the rest in the 「⋯」 menu). The `md` breakpoint, read
39+
* against the header's own width, so a main area narrowed by the AI panel, a
40+
* small window or the record drawer gets it, and a full-width list does not.
41+
*/
42+
const LIST_HEADER_COMPACT_WIDTH = 768;
43+
3544
/**
3645
* The list title 「OBJECT / VIEW ▾」 (objectstack#27950): the page
3746
* header is the one place a page is named (objectui#12461), and with the view
@@ -230,6 +239,7 @@ export function ObjectViewPageHeader({
230239
</>
231240
}
232241
foldedActions={foldedHeaderActions}
242+
compactBelow={LIST_HEADER_COMPACT_WIDTH}
233243
/>
234244
</div>
235245
);

‎ui/packages/components/src/renderers/complex/__tests__/data-table-scroll-shadow-12463.test.tsx‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,50 @@ describe('data-table scroll box, sticky columns and right-edge shadow (objectui#
140140
expect(queryByTestId('data-table-scroll-shadow-right')).toBeNull();
141141
});
142142
});
143+
144+
/**
145+
* objectstack#35446 — while the table is wider than its box the box draws its
146+
* scrollbar at rest, so columns out of view are announced without the pointer
147+
* over the box; a table that fits keeps the shared hover-only bar
148+
* (objectui#12708). The box's geometry is stubbed before the table mounts,
149+
* because the read is taken at mount and on resize, not on scroll.
150+
*/
151+
describe('data-table scrollbar at rest while the table scrolls sideways (objectstack#35446)', () => {
152+
const AT_REST = '[scrollbar-color:var(--color-muted-foreground)_transparent]!';
153+
const TRANSPARENT = '[scrollbar-color:transparent_transparent]!';
154+
155+
function stubBoxWidths(scrollWidth: number, clientWidth: number): () => void {
156+
const proto = HTMLElement.prototype;
157+
const isBox = (el: HTMLElement) => el.hasAttribute('data-table-scroll-box');
158+
Object.defineProperty(proto, 'scrollWidth', { configurable: true, get(this: HTMLElement) { return isBox(this) ? scrollWidth : 0; } });
159+
Object.defineProperty(proto, 'clientWidth', { configurable: true, get(this: HTMLElement) { return isBox(this) ? clientWidth : 0; } });
160+
return () => {
161+
delete (proto as unknown as Record<string, unknown>).scrollWidth;
162+
delete (proto as unknown as Record<string, unknown>).clientWidth;
163+
};
164+
}
165+
166+
it('a table wider than its box draws the bar at rest', () => {
167+
const restore = stubBoxWidths(1400, 700);
168+
try {
169+
const { getByTestId } = renderTable(baseSchema);
170+
const classes = getByTestId('data-table-scroll-box').className.split(/\s+/);
171+
expect(classes).toContain(AT_REST);
172+
expect(classes).not.toContain(TRANSPARENT);
173+
} finally {
174+
restore();
175+
}
176+
});
177+
178+
it('CONTROL: a table that fits keeps the hover-only bar', () => {
179+
const restore = stubBoxWidths(700, 700);
180+
try {
181+
const { getByTestId } = renderTable(baseSchema);
182+
const classes = getByTestId('data-table-scroll-box').className.split(/\s+/);
183+
expect(classes).toContain(TRANSPARENT);
184+
expect(classes).not.toContain(AT_REST);
185+
} finally {
186+
restore();
187+
}
188+
});
189+
});

0 commit comments

Comments
 (0)