Skip to content

fix(fields): the lookup picker fits the room it is given, marks a cut row, and lets option previews wrap - #34381

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-vne3eb
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-vne3eb

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34362

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:查找字段快选弹层的选项列表不再固定 16rem 高:弹层不超过 Radix 报告的可用高度(搜索框保持高度,列表占剩余空间,上限仍是 16rem);列表上下还有更多选项时,那一侧边缘渐隐,被切开的行读作「可继续滚动」;每个选项的副标题放不下时整列换到第二行(最多两行),不再把邮箱和所属客户一起截断;仍被截断的文本值悬停可见全文(title)。
  • 为什么改:实测根因不是对话框挡住了翻转。弹层本就 portal 到 body,Radix 在对话框里照常翻到空间更大的一侧;「只露 4½ 行、最后一行半截」是固定 16rem(256px)列表高度对上 56px 行高的必然结果,在哪里打开都一样,且没有任何滚动提示。窗口较矮、两侧都放不下时,弹层还会超出屏幕。
  • 风险与回滚:只改 @object-ui/fields 的 LookupField 弹层/列表/选项行,无契约与服务端改动;未改共享 popover.tsx。副标题由单行变为最多两行,选项行可能变高,16rem 内可见行数会减少(两行副标题时约 3½ 行)。回滚即 revert 本 PR。
  • 先看:① ui/packages/fields/src/widgets/LookupField.tsx 的 fitPreviewLine(换行、行数上限、换行列去掉分隔点、截断值写 title);② 同文件 PopoverContent 与 listbox 的类名及 listMore 渐隐;③ 测试文件 LookupField.previewBadges-13123.test.tsx 改写的布局模型。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/fields/src/widgets/LookupField.previewBadges-13123.test.tsx,预期 17 个测试全过。
  • 需要你做的:无,席位落地。

Root cause (measured)

Measured in Chromium with the real LookupField and the real Dialog, bundled from source (the bundling of e2e/permission-field-panel-scroll.spec.ts, real Tailwind theme), inside a dialog with the action dialog's classes (flex max-h-[90vh] flex-col), at 1280×800, with ten contacts previewing Email and Account like the card's picker. The probe was a one-off and is not committed.

  • The popover does flip inside a dialog. PopoverContent already renders through a Radix portal into body, so no dialog body clips it, and Radix's default flip measures against the viewport. With the field near the dialog's bottom (space below 259 / 179 / 121 px, above 501 / 581 / 639 px) the popover opened on top every time (data-side="top"), fully inside the viewport. No collision boundary and no portal problem.
  • The "4½ rows, last one cut mid-row" is the list's fixed max-h-64. The list was 256 px whatever the room. An option with a one-line preview is 56 px tall, so the fifth row always showed 32 of its 56 px: its name, not its preview, exactly as the card describes, below or above the field alike, with nothing saying the list scrolls.
  • The cap also ignored the room it was given. At 1280×480, with 179 px below and 261 px above, the 306 px popover flipped up and ran 49 px off the top of the screen (--radix-popover-content-available-height read 257 px; the list ignored it).
  • The subtitle cut both fields because it was one row. Two text columns side by side each shrink to share one row, so Email: emily.davis@starkmed.e… and Account: Stark Medic… were both cut, and the account name that tells same-named contacts apart was lost.

After the fix, same probe: the popover still opens on top at 259 / 179 / 121 px below; at 1280×480 it is 257 px tall at top: 0 (inside the viewport) with the list at 207 px; every preview shows the full email on its first row and the full account on its second; the cut row at the list's bottom sits under a fade.

What changes

  • PopoverContent (in LookupField, not the shared popover.tsx): flex flex-col max-h-(--radix-popover-content-available-height). The search row, the error state and the loading state are shrink-0; the list (in a relative flex min-h-0 flex-col wrapper) is max-h-64 min-h-0, so it takes what the search row leaves, up to the same 16rem. Radix's default flip is kept: it still moves the popover to the side with more room whenever the whole popover does not fit below.
  • Scroll cue: listMore tracks whether options continue above or below the list's visible box (read after every commit, on scroll, and from a ResizeObserver on the list, attached by a callback ref); each edge with more past it draws an aria-hidden gradient (lookup-list-more-above / lookup-list-more-below). The list carries scroll-py-6, so the arrow keys' scrollIntoView({ block: 'nearest' }) stops an option clear of the fade.
  • Option preview: the line is flex-wrap (gap-x-1 gap-y-0.5). fitPreviewLine now hides trailing segments while the line overflows its width OR its shown segments span more than LOOKUP_PREVIEW_MAX_ROWS (2) rows, read off the segments' offsetTop. So a column that does not fit beside the one before it moves whole to the second row, and a column that does not fit in two rows leaves whole, with every column after it. A shown segment that opens a row hides its leading ·. A text value (data-lookup-preview-text) whose box is narrower than its content gets its full text as title; one that fits has none. The objectui#13123 rules stand: a badge column never shrinks, a text value never shrinks below its label.
  • The ORDER of the previewed columns is untouched: it is the app's authored config.
  • Changeset: .changeset/34362-lookup-picker-room.md (@object-ui/fields: patch).

Tests

All in the existing shared harness file LookupField.previewBadges-13123.test.tsx (jsdom has no layout, so the pins read classes, attributes and stubbed boxes, not pixels):

  • New describe('LookupField picker popover: bound to the room it is given (objectstack#34362)'): the popover is portaled out of the field into Radix's popper wrapper; it carries flex, flex-col and max-h-(--radix-popover-content-available-height); the search row is shrink-0; the list is min-h-0 max-h-64 overflow-y-auto in a min-h-0 wrapper; the below / above fades follow a stubbed scroll box through scroll to the end and back; no fade when every option fits; the list carries scroll-py-6.
  • New describe('LookupField option preview: secondary columns stay told apart (objectstack#34362)'): the line is flex-wrap; a column that opens the second row drops its separator, one beside its predecessor keeps it, and every separator stays on one row; a cut text value gets its full text as title, a whole one and a badge get none.
  • Forced edit to existing tests, named: the layout model behind describe('LookupField option preview: a column the line cannot hold leaves whole (objectui#13123)') (renamed "…the rows cannot hold…") now wraps segments onto rows (offsetTop stubbed) instead of modelling one row, because the line now wraps. Its cases moved with the model: at 280 px all three columns show (revenue wraps to row two, was dropped); at 180 px status and industry show (one column a row, the third row is one too many; was status only); 600 px and 100 px are unchanged. The resize case now goes 180 → 600 → 100 px ([status, industry] → all → none). Every assertion of the three "badge never cut / text still truncates / segment whole" tests above it is unchanged.

Acceptance notes

  • None filed.
  • The 16rem list cap is kept. With a two-row preview an option is 74 px, so about 3½ options show in 16rem where 4½ did; the fade marks the cut. Whether the cap should grow is a product call left open in the report, not made here.
  • No docs page describes the typeahead's placement or preview layout (content/docs/data-modeling/field-types.mdx describes the picker's features only), so no docs change is owed.
  • popover.tsx (shared by every popover) is not touched: the cause was in the lookup's own list, not in the primitive.

Verification

Tests
  • pnpm --dir ui exec vitest run packages/fields/src/widgets/LookupField.previewBadges-13123.test.tsx → Tests 17 passed.
  • pnpm --dir ui exec vitest run packages/fields/ --maxWorkers=2 → Test Files 306 passed, 1 skipped; Tests 4633 passed, 7 skipped.
  • pnpm --filter @object-ui/fields run type-check (tsc --noEmit && tsc -p tsconfig.test.json) → exit 0.
  • pnpm --dir ui exec eslint on the two changed files → exit 0 (0 errors; the warnings are pre-existing lines). pnpm --dir ui run check:new-line-citations → 0 new citations.
Ablations (scripts/ablation-replace.mjs, mutation proven on disk, each restored to HEAD blob 010d418f431b)
  • A1 drop max-h-(--radix-popover-content-available-height) from the popover → "caps the popover…" red (1 failed / 16 passed).
  • A2 drop min-h-0 from the list → "caps the popover…" red (1 / 16).
  • A3 below: always false → "marks the list edge…" red (1 / 16).
  • A4 delete the row cap (|| previewRowsOf(segments) > LOOKUP_PREVIEW_MAX_ROWS) → the 180 px case and the resize case red (2 / 15).
  • A5 delete if (separator && opensRow) separator.hidden = true; → "drops the separator…" red (1 / 16).
  • A6 write no title on a cut value → "gives a text value cut short…" red (1 / 16).
  • A7 drop flex-wrap → "lets the preview wrap…" red (1 / 16).
Derived gate families

Head c3c5b8cc, node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 38 commands, all exit 0. --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.

node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0

Every family CI runs is read from this PR's check-runs, not re-run here.


Generated by Claude Code

…p the preview

The option list takes the room Radix reports on the side the popover opens
to, fades the edge it continues past, and lets an option's preview wrap onto
a second row so two text columns are not both cut to one row.

Claude-Session: https://claude.ai/code/session_01ADHkmSg4bMFcuXXpNikRnL
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

维护者速读

席位意见

先测出真正的原因(固定高度,而不是没有翻转),再在查找控件里按可用空间约束,没有改共享的 popover。边缘渐隐让被切掉的行读作「还能滚动」。副标题仍守 #13123 的规则:徽标不收缩,值截断但不短于标签。同意落地。

席位核对 — ACCEPT · domain:ui#2 · head 3e202af · 2026-11-16T21:57Z

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43965649708 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (4/16) — 失败步骤: Fetch this commit's history and the base branch(日志不可读,点进 job 看)

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • ⚠️ 本次没有可用的聚合签名(日志里没有能解析出测试文件名的 FAIL 行)—— 这不是「没有同签名的其他 PR」,是这一轮没测到。跨 PR 聚合本次不可用,请手工比对其他 PR 的同类评论。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 36 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

Merge-queue triage: re-queue once · head 3e202af · 2026-11-16T22:30Z

The queue build 43965649708 failed in one job, Test UI (4/16), and no test ran in it. The job stopped at the step Fetch this commit's history and the base branch, which timed out after 14 minutes on a git fetch. The roll-up Test UI job is red only because of that shard.

Re-queued once on the same head. If it fails again on a test, the seat triages it as this PR's.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit bdd5176 Nov 16, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-vne3eb branch November 16, 2026 23:00
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/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants