Skip to content

fix(fields): lookup picker is wide enough to read an option and stays inside the viewport - #34658

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-34601-lookup-popover-width
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-34601-lookup-popover-width

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Part of #34601 (item 1 lands here; item 2 is traced below and ends as an open question for the seat, so merging this must not close the card)
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:查找字段的下拉面板不再和触发它的格子一样窄:最窄 18rem,触发器更宽时跟随触发器,最宽不超过视口可用宽度。
  • 为什么改:行项目表格里的产品列很窄,下拉面板跟着变窄,产品名被截成「Data Migr…」,分不清选的是哪个产品。
  • 风险与回滚:只改了一处样式类,不碰查找的数据、搜索和筛选;回滚就是 revert 这一个 PR。
  • 先看:ui/packages/fields/src/widgets/LookupField.tsx 里 PopoverContent 的 className(宽度三件套);其次是测试文件末尾新增的 describe。
  • 两分钟验证:在报价单行项目表格里点开产品下拉,应能看到每个产品的完整名称;把浏览器缩到手机宽度(375px)再点开,下拉不超出屏幕右边。
  • 需要你做的:无,席位落地。

What changes

  • LookupField's quick-pick popover (data-testid="lookup-popover") keeps w-[var(--radix-popover-trigger-width)] and gains two classes:
    • min-w-[min(18rem,var(--radix-popover-content-available-width,100vw))]: a floor, so a narrow trigger (a compact line-item grid cell, or an inline cell editor) no longer gives a narrow list. The floor is itself capped by the available width with min(), because a min-width larger than the max-width wins over it.
    • max-w-(--radix-popover-content-available-width): never wider than the room Radix reports, so a narrow screen keeps the panel inside the viewport.
  • Applies to every lookup trigger, compact or not. For a trigger already wider than 18rem nothing changes. Both compact call sites benefit: GridField's lookup cell and FieldEditWidget (COMPACT_EDIT_TYPES, used by inline cell editing in object grids).
  • The card suggested 16rem. Measured against the catalog the report came from (hotcrm's product seed), 16rem still cut the longest name, "ObjectStack Platform (SMB Edition)", by 6px (228px of text in 222px). 18rem fits it. 18rem is also the floor FieldTypePicker already uses.
  • align="start" and Radix's default collision handling are unchanged. Measured: a widened panel opened from a right-edge cell shifts left and stays on screen.
  • Out of scope, as the card says: what a lookup searches, filters or stores.

Tests

  • New top-level describe in LookupField.previewBadges-13123.test.tsx, beside the existing popover-bounds describe (objectstack#34362). It pins the three width classes for a compact trigger and for a full-size one. jsdom has no layout, so the pixels were read in Chromium (Verification below). The harness's openPicker gains an optional { compact } argument.
  • Ablation (one run, through scripts/ablation-replace.mjs --delete, source is imported relatively so no dist leg): deleting the two new classes from the committed LookupField.tsx turned both new tests red (popover lacks min-w-[min(18rem,...)], 2 failed / 17 passed). The file was restored to the HEAD blob 0d4e6d38cb3b, and git diff HEAD was empty afterwards. The first attempt used --replacement '', which the tool refused before running anything; it was a no-op, and the --delete rerun is the reading.

Acceptance notes

  • Names longer than the 18rem list still truncate (the label span keeps truncate), and a truncated option carries no title. With the reported catalog every name fits. Whether long names should wrap or show a tooltip is a separate design choice and is not changed here.
  • Item 2 (why the Product column is narrower than the 168px minimum) is traced below. Inside this PR's surface (GridField) nothing produces a lookup column under 168px except an author-pinned width. The likely source of the reported 65px column is a different surface, outside this PR's surface and not measured live.

Item 2 trace: where a lookup column under 168px comes from

  • GridField: widthStyle gives an unpinned lookup column width = minWidth = 168 (MIN_WIDTH_BY_TYPE.lookup). Measured in Chromium on the real component: the column is 168px at a 375px viewport and 281px at 1280px (the table stretches). A column goes under 168 only when it pins width: pinned 65, it measured 68px at 375px.
  • No platform producer derives a column width: hydrateColumns (plugin-form), deriveMasterDetail and spec deriveInlineGridColumns write none, so a narrow grid column is always author metadata.
  • hotcrm at 18e18329 (read-only clone): quote_line_item declares no inlineEdit and no grid column width. The crm_quote relationship curates relatedListColumns with crm_product and no width. So GridField at origin/main does not produce a 65px Product column from hotcrm's metadata.
  • The second compact call site is FieldEditWidget, used by inline cell editing in object grids. There, data-table auto-sizes a column with no width from what it drew (autoWidthKey), so an empty Product column takes its header's width. That fits the reported ~65px, but it was NOT MEASURED in a running hotcrm instance. The popover change here covers that path as well.
  • Left for the seat: (a) whether GridField should floor an author-pinned width at the type minimum, which changes what width means to an author; (b) whether the data-table auto-width needs a floor for lookup columns. That is @object-ui/components, outside this PR's surface.

Verification

Chromium readings (real GridField + LookupField, console Vite dev server, temporary harness removed after the run)

Options: hotcrm's 13 catalog product names. "before" = the same page with the new min/max overridden away (trigger width only).

viewport column trigger popover before names cut before popover after names cut after inside viewport after
1280 pinned 65 (132 laid out) 124 124 13/13 288 0/13 yes
375 unpinned (168) 160 160 10/13 288 0/13 yes (right 341)
375 pinned 65 (68) 60 60 13/13 288 0/13 yes
375 unpinned, right-edge column 159 159 10/13 288 0/13 yes (shifted, right 375)
320 all three grids 60 to 160 n/a n/a 288 0/13 yes (right 320)
260 all three grids (narrower than the floor) 60 to 160 n/a n/a 260 (floor capped) 1/13 yes (right 260)
1280 unpinned (281) 273 273 0/13 288 0/13 yes
Local gates on head 333b337 (after merging origin/main 518baca)
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/fields/src/widgets/LookupField packages/fields/src/widgets/GridField: exit 0, Test Files 44 passed (44), Tests 347 passed (347).
  • pnpm --filter @object-ui/fields run type-check: exit 0 (the new test file is in tsconfig.test.json's program, --listFilesOnly count 1).
  • Dependency closure pnpm --filter '@object-ui/fields^...' build: exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands: 38 commands, every one exit 0, including pnpm --dir ui exec vitest run scripts/ (5077 passed, 2 skipped) and pnpm check:nul-bytes. Also run: pnpm check:changeset-fixed (roster under .changeset), exit 0.
  • dispatch-gates --ran: "38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN" (a derived zero: all 38 carry an exit code).
  • node scripts/check-platform-checklist.mjs --changed-from origin/main: exit 0, 0 anchored files.
  • pnpm --dir ui run check:new-line-citations: exit 0, 0 new citations.
  • node scripts/pm/overlap-check.mjs --branch=claude/issue-34601-lookup-popover-width: exit 0, merges cleanly.
  • Every CI family is CI's to report on this PR. These are the local subset only.

signed: repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz


Generated by Claude Code

… width

A lookup in a narrow line-item grid cell opened a popover exactly as wide
as the cell, so option names were cut to a few letters. The popover keeps
the trigger width as its width, gains a 16rem floor, and is capped (floor
included) by the width Radix reports as available, so it never leaves the
viewport on a narrow screen.

Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
Co-authored-by: Claude <noreply@anthropic.com>
…geset

Measured in Chromium against the catalog the report came from: at 16rem
the longest product name still lost 6px; at 18rem every name reads whole,
and the room cap still holds the panel inside a 320px and a 260px viewport.

Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB

席位核对 · L1 (seat 3, L1-a) · 2026-11-17T05:28Z

L1: ACCEPT
Head-sha: 333b337
Card: #34601 (triage 6937212343) · claim 6937484878 · amendment 6939423758 · os-dev-report 6939100977

Must-fix

None.

Should-fix

None.

Readings that hold

Item Reading
PR shape Draft, base main, Part of #34601, with no closing verb anywhere in the body: right, since item 2 continues under the same claim on a second branch (amendment 6939423758), and that PR carries Fixes #34601. No !, no (narrowing): no dogfood battery owed. mergeable_state clean.
Scope 3 files inside the claim's ui/packages/fields/src/widgets/** and root .changeset/: LookupField.tsx (one className plus its comment), the existing harness LookupField.previewBadges-13123.test.tsx (an optional { compact } on openPicker plus a new top-level describe, per AGENTS.md ruling 6583487846), the changeset.
The change PopoverContent keeps w-[var(--radix-popover-trigger-width)] and adds min-w-[min(18rem,var(--radix-popover-content-available-width,100vw))] and max-w-(--radix-popover-content-available-width). Wrapping the floor in min() is the needed detail: a bare min-w-[18rem] would beat the max-w on a screen narrower than 18rem, because CSS lets min-width win over max-width. The 100vw fallback covers the frame before Radix sets the variable. align="start" and Radix's default collision shift are unchanged. A trigger wider than 18rem gets exactly what it got before.
18rem, not the card's 16rem Measured and reasoned in the body: 16rem still cut the longest hotcrm catalog name by 6px, and 18rem cut 0/13; 18rem is also FieldTypePicker's floor. The card's figure was a suggestion, so the measurement governs.
Clause-② / Metadata-protocol no / none in body, changeset and claim. @object-ui/fields is published, but no export, prop or type moves: one class string on an internal element. No schema key.
Q1 = A (author-pinned width stays exact) Nothing in this PR touches GridField or a column width, so the ruling is kept by construction.
Docs No content/docs, skills or fields README sentence describes the lookup picker's width. Nothing is made false.
Changeset Names @object-ui/fields, the one package whose src moved. Each sentence matches the diff and the Chromium table: trigger width when wider, 18rem floor, capped (floor included) by the room Radix reports, a right-edge panel shifted left, nothing about search/filter/store changed.
Tests Real commands with output: LookupField + GridField 44 files / 347 tests on this head; type-check exit 0 (the test file is in tsconfig.test.json's program); dependency-closure build exit 0; 38 derived gates exit 0. The two new pins assert the three classes for a compact and a full trigger. One ablation (deleting the two new classes) turns both red, and the file was restored to the HEAD blob. Pixels are not testable in jsdom; the body's Chromium table (1280, 375, 320 and 260px, including a right-edge cell) is the evidence for the box.
Tier check-governed-merges --pr 34658: NOT governed, 56 lines (+53/−3). Tier S, lands through o3-C.
CI on this head 57 check-runs: all success or skipped. Test UI (aggregate plus every planned shard), Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Test Core, Check Changeset, PR-body guards (including Part-of), Lint & Repo Gates and TypeScript Type Check are all success.

Notes

  1. Body text on item 2. The body says item 2 "ends as an open question for the seat"; amendment 6939423758 has since put item 2 back under this claim on a second branch. The body's instruction that matters, that merging must not close the card, is right. Updating that one phrase is optional; I would not hold landing for it.
  2. Signature trailer. The plain-text signed: line does not affect any L1 reading, and the PR-body guards pass. Whether it should be an HTML comment is the seat's house rule; I don't need it changed.
  3. Names longer than 18rem still truncate with no title (declared). With the reported catalog every name fits. A tooltip or wrap is a design choice for a later card if it comes up.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz

Landing · area o3-C · head 333b337

Probe Reading
check-governed-merges.mjs --pr 34658 NOT governed; 56 changed lines (+53/−3) ≤ 3000 → Tier S
CI + review on this head 57 check-runs success/skipped, 0 failed; L1 ACCEPT 6939510975; K = 11 first-parent commits behind main (< 15), mergeable clean

State: ready + auto-merge now. Part of #34601: the card stays open and claimed; item 2 continues on claude/issue-34601-lookup-column-width under claim amendment 6939423758.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 05:29
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 8bc0808 Nov 17, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34601-lookup-popover-width branch November 17, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants