Skip to content

Commit bdd5176

Browse files
fix(fields): the lookup picker fits the room it is given, marks a cut row, and lets option previews wrap (#34381)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9QSmT6s2ZTGps4fXHsTwFbT)_ 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 <details><summary>Tests</summary> - `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. </details> <details><summary>Ablations (scripts/ablation-replace.mjs, mutation proven on disk, each restored to HEAD blob 010d418)</summary> - 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). </details> <details><summary>Derived gate families</summary> 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. ```text 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. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSg4bMFcuXXpNikRnL)_ Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 495a79c commit bdd5176

3 files changed

Lines changed: 296 additions & 37 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/fields': patch
3+
---
4+
5+
fix(fields): the lookup picker's list fits the room it is given, marks a cut row as "scroll for more", and lets an option's secondary fields wrap
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The lookup quick-picker's option list had a fixed 16rem height. With a one-line preview under each option, that height ends part-way through the fifth row, so the last visible option showed its name and lost its preview, with nothing saying the list scrolls. On a short window the popover was also taller than the room on either side of the field and ran off the screen. Radix already flips the popover to the side with more room, inside a dialog too; the list simply ignored how much room that side had.
11+
12+
- The popover is now no taller than the room Radix reports on the side it opens to. The search row keeps its height and the list takes what is left, up to the same 16rem.
13+
- When options continue past the top or the bottom edge of the list, that edge fades out, so a row cut there reads as "scroll for more". The keyboard scrolls the active option clear of the fade.
14+
- An option's preview wraps onto a second row when its columns do not fit side by side, so two text columns (an email and an account name, say) are no longer both cut to fit one row. A column that does not fit on two rows leaves whole, as before; a badge is never cut and a text value is never cut below its label. A text value that is still cut short shows its whole text on hover.

‎ui/packages/fields/src/widgets/LookupField.previewBadges-13123.test.tsx‎

Lines changed: 162 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,52 @@ describe('LookupField option preview: a badge is never cut (objectui#13123)', ()
173173
});
174174

175175
/**
176-
* The line's layout, modelled: each column has a width, the segments sit 4px
177-
* apart, and a hidden segment takes no room. `lineWidth` is the line's box.
176+
* The preview's layout, modelled: each column has a width, the segments sit
177+
* 4px apart and wrap onto the next row (20px down) when they do not fit beside
178+
* the one before, a hidden segment takes no room, and a badge wider than the
179+
* line overflows it where a text column would shrink to it. `lineWidth` is the
180+
* line's box.
178181
*/
179182
const COLUMN_WIDTH: Record<string, number> = { status: 114, industry: 148, annual_revenue: 130 };
183+
const BADGES = new Set(['status', 'industry']);
180184
let lineWidth = 0;
181185

186+
const isLine = (el: Element | null): el is HTMLElement => (el as HTMLElement | null)?.dataset?.testid === 'lookup-option-preview';
187+
const fieldOf = (segment: Element) =>
188+
segment.querySelector('[data-lookup-preview]')?.getAttribute('data-lookup-preview') ?? '';
189+
190+
/** Each shown segment's row offset, and the widest badge the line must hold. */
191+
function layoutOf(line: HTMLElement): { tops: Map<Element, number>; widest: number } {
192+
const tops = new Map<Element, number>();
193+
let x = 0;
194+
let row = 0;
195+
let widest = 0;
196+
for (const segment of Array.from(line.children)) {
197+
if ((segment as HTMLElement).hidden) continue;
198+
const field = fieldOf(segment);
199+
const natural = COLUMN_WIDTH[field] ?? 0;
200+
const width = BADGES.has(field) ? natural : Math.min(natural, lineWidth);
201+
if (BADGES.has(field)) widest = Math.max(widest, natural);
202+
if (x > 0 && x + 4 + width > lineWidth) {
203+
row += 1;
204+
x = 0;
205+
}
206+
x += (x > 0 ? 4 : 0) + width;
207+
tops.set(segment, row * 20);
208+
}
209+
return { tops, widest };
210+
}
211+
182212
function stubLineLayout(): void {
183-
const isLine = (el: HTMLElement) => el.dataset.testid === 'lookup-option-preview';
184213
vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(function (this: HTMLElement) {
185214
return isLine(this) ? lineWidth : 0;
186215
});
187216
vi.spyOn(HTMLElement.prototype, 'scrollWidth', 'get').mockImplementation(function (this: HTMLElement) {
188-
if (!isLine(this)) return 0;
189-
const shown = Array.from(this.children).filter((s) => !(s as HTMLElement).hidden);
190-
const content = shown.reduce((sum, s) => {
191-
const field = s.querySelector('[data-lookup-preview]')?.getAttribute('data-lookup-preview') ?? '';
192-
return sum + (COLUMN_WIDTH[field] ?? 0);
193-
}, 0);
194217
// The browser reports the box's own width when the content is narrower.
195-
return Math.max(lineWidth, content + 4 * Math.max(0, shown.length - 1));
218+
return isLine(this) ? Math.max(lineWidth, layoutOf(this).widest) : 0;
219+
});
220+
vi.spyOn(HTMLElement.prototype, 'offsetTop', 'get').mockImplementation(function (this: HTMLElement) {
221+
return isLine(this.parentElement) ? layoutOf(this.parentElement).tops.get(this) ?? 0 : 0;
196222
});
197223
}
198224

@@ -216,11 +242,12 @@ function shownColumns(): string[] {
216242
return ['status', 'industry', 'annual_revenue'].filter((f) => !segmentOf(f).hidden);
217243
}
218244

219-
describe('LookupField option preview: a column the line cannot hold leaves whole (objectui#13123)', () => {
245+
describe('LookupField option preview: a column the rows cannot hold leaves whole (objectui#13123)', () => {
220246
it.each([
221-
// The card's width: both badges whole, the revenue column dropped.
222-
[280, ['status', 'industry']],
223-
[180, ['status']],
247+
// The card's width: the revenue column wraps onto the second row whole.
248+
[280, ['status', 'industry', 'annual_revenue']],
249+
// One column a row: a third row is one too many, so revenue leaves.
250+
[180, ['status', 'industry']],
224251
[600, ['status', 'industry', 'annual_revenue']],
225252
// Not even the first badge fits: the line drops it rather than cut it.
226253
[100, []],
@@ -244,15 +271,133 @@ describe('LookupField option preview: a column the line cannot hold leaves whole
244271
lineWidth = 180;
245272
stubLineLayout();
246273
await openPicker(['name', 'status', 'industry', 'annual_revenue']);
247-
expect(shownColumns()).toEqual(['status']);
274+
expect(shownColumns()).toEqual(['status', 'industry']);
248275
expect(lineObservers.length).toBeGreaterThan(0);
249276

250277
lineWidth = 600;
251278
act(() => lineObservers.forEach((fire) => fire()));
252279
expect(shownColumns()).toEqual(['status', 'industry', 'annual_revenue']);
253280

254-
lineWidth = 280;
281+
lineWidth = 100;
255282
act(() => lineObservers.forEach((fire) => fire()));
256-
expect(shownColumns()).toEqual(['status', 'industry']);
283+
expect(shownColumns()).toEqual([]);
284+
});
285+
});
286+
287+
/** The `·` that leads every column after the first. */
288+
function separatorOf(field: string): HTMLElement {
289+
const sep = segmentOf(field).querySelector<HTMLElement>('[data-lookup-preview-separator]');
290+
if (!sep) throw new Error(`no separator before ${field}`);
291+
return sep;
292+
}
293+
294+
describe('LookupField option preview: secondary columns stay told apart (objectstack#34362)', () => {
295+
it('lets the preview wrap, so a column that does not fit opens the next row instead of cutting both', async () => {
296+
await openPicker(['name', 'status', 'billing_email']);
297+
const line = screen.getByTestId('lookup-option-preview');
298+
expect(line.classList.contains('flex-wrap'), 'the preview no longer wraps').toBe(true);
299+
});
300+
301+
it('drops the separator of a column that opens a row, and keeps it beside the column before', async () => {
302+
lineWidth = 280;
303+
stubLineLayout();
304+
await openPicker(['name', 'status', 'industry', 'annual_revenue']);
305+
// Row one: status, industry. Row two: revenue.
306+
expect(separatorOf('industry').hidden).toBe(false);
307+
expect(separatorOf('annual_revenue').hidden).toBe(true);
308+
});
309+
310+
it('keeps every separator on one row', async () => {
311+
lineWidth = 600;
312+
stubLineLayout();
313+
await openPicker(['name', 'status', 'industry', 'annual_revenue']);
314+
expect(separatorOf('industry').hidden).toBe(false);
315+
expect(separatorOf('annual_revenue').hidden).toBe(false);
316+
});
317+
318+
it('gives a text value cut short its whole text as its title, and a whole value none', async () => {
319+
const CUT = 'billing_email';
320+
vi.spyOn(HTMLElement.prototype, 'scrollWidth', 'get').mockImplementation(function (this: HTMLElement) {
321+
return this.getAttribute('data-lookup-preview') === CUT ? 300 : 0;
322+
});
323+
vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(function (this: HTMLElement) {
324+
return this.getAttribute('data-lookup-preview') === CUT ? 120 : 0;
325+
});
326+
await openPicker(['name', 'status', ...TEXT_COLUMNS]);
327+
328+
expect(valueOf(CUT).getAttribute('title')).toBe(ROW.billing_email);
329+
expect(valueOf('annual_revenue').hasAttribute('title')).toBe(false);
330+
// A badge keeps its own title; the fit never writes one onto its value.
331+
expect(valueOf('status').hasAttribute('title')).toBe(false);
332+
});
333+
});
334+
335+
describe('LookupField picker popover: bound to the room it is given (objectstack#34362)', () => {
336+
/** The listbox's scroll box, stubbed: `content` px of options in a `box` px list. */
337+
function stubListScroll(box: number, content: number): void {
338+
const isList = (el: HTMLElement) => el.getAttribute('role') === 'listbox';
339+
vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(function (this: HTMLElement) {
340+
return isList(this) ? box : 0;
341+
});
342+
vi.spyOn(HTMLElement.prototype, 'scrollHeight', 'get').mockImplementation(function (this: HTMLElement) {
343+
return isList(this) ? content : 0;
344+
});
345+
}
346+
347+
it('is portaled out of the field, so no dialog body can clip it and Radix flips it against the viewport', async () => {
348+
await openPicker(['name', 'status']);
349+
const popover = screen.getByTestId('lookup-popover');
350+
expect(screen.getByTestId('lookup-trigger').parentElement?.contains(popover)).toBe(false);
351+
expect(popover.parentElement?.hasAttribute('data-radix-popper-content-wrapper')).toBe(true);
352+
});
353+
354+
it('caps the popover at the available height Radix reports, and the list takes what the search row leaves', async () => {
355+
await openPicker(['name', 'status']);
356+
const popover = screen.getByTestId('lookup-popover');
357+
for (const cls of ['flex', 'flex-col', 'max-h-(--radix-popover-content-available-height)']) {
358+
expect(popover.classList.contains(cls), `popover lacks ${cls}`).toBe(true);
359+
}
360+
const search = screen.getByRole('combobox').closest('.p-2') as HTMLElement;
361+
expect(search.classList.contains('shrink-0'), 'the search row gives up its height').toBe(true);
362+
const list = screen.getByRole('listbox');
363+
// `min-h-0` lets the list shrink below its 16rem cap; the cap still holds where there is room.
364+
for (const cls of ['min-h-0', 'max-h-64', 'overflow-y-auto']) {
365+
expect(list.classList.contains(cls), `list lacks ${cls}`).toBe(true);
366+
}
367+
expect((list.parentElement as HTMLElement).classList.contains('min-h-0'), 'the list wrapper does not shrink').toBe(true);
368+
});
369+
370+
it('marks the list edge with more options past it, so a row cut there reads as scroll for more', async () => {
371+
stubListScroll(256, 600);
372+
await openPicker(['name', 'status']);
373+
const list = screen.getByRole('listbox');
374+
await waitFor(() => expect(screen.queryByTestId('lookup-list-more-below')).not.toBeNull());
375+
expect(screen.queryByTestId('lookup-list-more-above')).toBeNull();
376+
377+
act(() => {
378+
list.scrollTop = 344;
379+
fireEvent.scroll(list);
380+
});
381+
expect(screen.queryByTestId('lookup-list-more-below')).toBeNull();
382+
expect(screen.queryByTestId('lookup-list-more-above')).not.toBeNull();
383+
384+
act(() => {
385+
list.scrollTop = 100;
386+
fireEvent.scroll(list);
387+
});
388+
expect(screen.queryByTestId('lookup-list-more-below')).not.toBeNull();
389+
expect(screen.queryByTestId('lookup-list-more-above')).not.toBeNull();
390+
});
391+
392+
it('draws no edge marks when every option fits', async () => {
393+
stubListScroll(256, 120);
394+
await openPicker(['name', 'status']);
395+
expect(screen.queryByTestId('lookup-list-more-below')).toBeNull();
396+
expect(screen.queryByTestId('lookup-list-more-above')).toBeNull();
397+
});
398+
399+
it('leaves room for the edge mark when the keyboard scrolls an option into view', async () => {
400+
await openPicker(['name', 'status']);
401+
expect(screen.getByRole('listbox').classList.contains('scroll-py-6')).toBe(true);
257402
});
258403
});

0 commit comments

Comments
 (0)