Skip to content

Commit 97e0f93

Browse files
fix(fields): on a phone a lookup's candidates open in a bottom drawer that scrolls by touch (#36863)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTDAJKyXUan6fJCKsZUf5Pv)_ Fixes #36832 repo:objectstack#3 · os-support-ai · session_01WGufziG2t1d9cfRQJDrHkB Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:在手机上点查找字段,候选列表改为从底部弹出的抽屉:顶部搜索、中间列表可用手指滑动、底部固定「+ 新建」和「查看全部结果」;电脑端不变。 - 为什么做:维护者在 iPhone 的新建表单里滑不动查找下拉列表,要求按 Attio 的样式「搜索,中间区域滚动,最下面固定增加」,且新建按权限显示。 - 出错会怎样:最坏是手机上抽屉高度或键盘遮挡不理想,仍可在搜索框里输入缩小范围或用旁边的表格按钮选;可整体撤回这一个提交。 - 要你做什么:无 ## What changes Confirmed cause, reproduced before any code change (Chromium, iPhone 13 emulation with touch, 390x844, a lookup with 25 of 60 candidates inside a Radix `Dialog` built from `MobileDialogContent`, as the phone create form is): - 4 swipes over the list: `scrollTop` 0 before and after; 40 of 40 `touchmove` events had `preventDefault` called, all from `react-remove-scroll`'s document-level listener (`shouldPrevent`, the isolation branch). - Why: Radix Dialog mounts `RemoveScroll` on its overlay with the dialog content as its only shard. The lookup popover portals to `document.body`, outside that shard and outside the lock's React tree, so every move over it is treated as an outside scroll and cancelled. CONTROL: the same lookup with no dialog scrolled 840px with no move cancelled. - The hypothesis on the card was right. The same lock also cancels the desktop wheel over the popover in a dialog (6 of 6 wheel events cancelled); that half, and the pinned footer, landed with the sibling card 36825 (PR 36844), which this branch builds on. - With the keyboard up (emulated by shrinking the window to 470px; Chromium has no on-screen keyboard), the popover kept a 255px list showing 4 rows and the create row sat 1000px below, unreachable. The fix, in `ui/packages/fields/src/widgets/LookupField.tsx` only, consuming the existing `Drawer` (vaul) and `useIsMobile` from `@object-ui/components`: - below the phone breakpoint (`useIsMobile`, the width the search-first variant's sheet already switches at) the candidate panel opens in a bottom `Drawer` (85dvh, titled with the field's label) instead of the popover. The drawer is its own modal layer, so its list is inside the topmost scroll lock and scrolls by touch. - the panel body is the same `lookupPanelBody` (recents, preview lines, keyboard and IME handling, `readListMore` fades, quick-create, `canCreate`), with a layout variant: the list takes the height between the search row and the pinned footer (`flex-1`, `overscroll-contain`) instead of the popover's `max-h-64` cap, and the footer pads for the safe area. - the search box is not focused on open (vaul's default), so the keyboard does not cover the list until the user taps it; when it does come up, vaul's `repositionInputs` keeps the drawer above it. - desktop popover, the list cell's editor and the search-first variant are unchanged by this PR. ## Tests - New `LookupField.phoneDrawer-36832.test.tsx`: phone width opens the drawer and no popover; CONTROL desktop width opens the popover and no drawer; the drawer holds the search row, the listbox and the pinned footer, with create and "show all" outside the listbox; a user without create sees no create row in the drawer; picking a candidate fills the field and closes the drawer; the search box is not focused on open. - The pinned-footer pins (`LookupField.createPinned-36825.test.tsx`, the footer rows in `LookupField.createGrant-12082.test.tsx`) come from PR 36844 and run against both faces' shared footer. - Package suite, gates and the ablations: readings in the os-dev-report comment on this PR, with the head sha they were taken on. ## Acceptance notes - Not measured: the list cell's editor inside a modal dialog (for example a subform grid) and the search-first variant's inline desktop popover; both are portalled the same way, outside this card's fence. - The on-screen keyboard cannot be emulated in Chromium; the keyboard-up readings shrink the window instead, which is what Android's resizes-content mode does. On iOS the drawer relies on vaul's visual-viewport repositioning, not measured here. ## Verification Read first: `LookupField.tsx` at the `panelFace === 'drawer'` branch (the drawer and its trigger), then the listbox class switch inside `lookupPanelBody`. Two minutes: on a phone (or a 390px-wide window with touch emulation), open a create form with a lookup and tap it: a drawer rises with the search box on top, the list swipes to its last row, and 「+ 新建」 / 「查看全部结果」 stay at the bottom. <details><summary>Browser readings (harness: Dialog + MobileDialogContent + LookupField, zh-Hans, 25 of 60 candidates)</summary> | case | panel | list height | rows in view | touch / wheel scroll | moves cancelled | create in view without scrolling | |---|---|---|---|---|---|---| | before, phone 390x844 | popover | 256 | 4 | 0 to 0 of 1168 | 40 of 40 | no (y=1806, in list) | | before, phone 390x470 (keyboard up) | popover | 255 | 4 | 0 to 0 of 1169 | 40 of 40 | no (y=1437, in list) | | after, phone 390x844 | drawer | 542 | 10 | 0 to 794 of 794 | 20 (overscroll guard; the list reached its end) | yes (y=796-840, footer) | | after, phone 390x470 (keyboard up), 8 swipes | drawer | 225 | 4 | 0 to 1111 of 1111 | 10 (overscroll guard; the list reached its end) | yes (y=421-465, footer) | | after, desktop 1280x800 in dialog (CONTROL face) | popover | 153 | 2 | wheel 0 to 1183 of 1183 | 2 | yes (footer) | Picking the last candidate filled the field and closed the panel in every row. Quick-create through an action provider on both faces: the create dialog opened and stayed open with focus inside it; saving filled the field, cancelling (Escape) closed only the create dialog, and the form dialog stayed open in both. Screenshots are kept in the dev's scratchpad (the relay takes no uploads). </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufziG2t1d9cfRQJDrHkB --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 573a376 commit 97e0f93

3 files changed

Lines changed: 268 additions & 17 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/fields': patch
3+
---
4+
5+
fix(fields): on a phone a lookup's candidates open in a bottom drawer that scrolls by touch
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
On a phone a create or edit form fills the screen as a modal dialog, and a lookup's candidate list opened in a small dropdown rendered outside that dialog. The dialog's scroll lock cancelled every touch move on it, so the list could not be scrolled by touch, and with the keyboard up the dropdown flipped above the field and showed only three or four rows.
11+
12+
Below the phone breakpoint (the width at which the search-first people picker already switches to a sheet) the candidate list now opens in a bottom drawer titled with the field's label: the search box at the top, the candidates scrolling by touch in the middle, and quick-create and "show all results" pinned at the bottom. The drawer follows the on-screen keyboard, and the search box is not focused when it opens, so the keyboard comes up only when the user taps it. Quick-create shows under the same rule as on the desktop: only when the field offers it and the user may create the target record. Picking a candidate fills the field and closes the drawer. The desktop dropdown and the list cell's editor are unchanged.
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* On a phone the lookup's candidate panel opens in a bottom drawer, not the
11+
* anchored popover (objectstack#36832).
12+
*
13+
* ## The defect
14+
*
15+
* On a phone a create or edit form is a full-screen modal dialog, and the
16+
* lookup's popover is portalled outside that dialog's DOM. The dialog's
17+
* scroll lock therefore cancelled every touch move on the popover: the list
18+
* could not be scrolled by touch, and with the keyboard up the popover flipped
19+
* above the field into the few rows of room left there. Measured in a phone
20+
* emulation (390x844, touch): 40 of 40 touch moves on the list cancelled,
21+
* `scrollTop` 0 before and after.
22+
*
23+
* ## What holds it now
24+
*
25+
* Below the phone breakpoint the panel is a bottom drawer: its own modal layer,
26+
* so its list scrolls by touch; the search row at the top, the list in the
27+
* middle taking the height left, and quick-create and "show all results" in
28+
* the footer pinned under it, gated exactly as in the popover.
29+
*
30+
* jsdom and happy-dom do no layout and no touch scrolling, so these pins hold
31+
* the face and its structure; the touch scrolling itself was measured in a
32+
* browser (the readings are on the pull request).
33+
*
34+
* ## The rows
35+
*
36+
* - phone width: the trigger opens the drawer, and no popover;
37+
* - CONTROL, desktop width: the trigger opens the popover, and no drawer;
38+
* - in the drawer the search row, the listbox and the footer are there, and
39+
* create and "show all" sit in the footer, outside the listbox;
40+
* - a user without create on the target sees no create row in the drawer;
41+
* - picking a candidate in the drawer fills the field and closes the drawer;
42+
* - the search box is not focused when the drawer opens, so the on-screen
43+
* keyboard does not cover the list until the user asks to type.
44+
*/
45+
import { render, screen, fireEvent, waitFor, act, cleanup, within } from '@testing-library/react';
46+
import '@testing-library/jest-dom';
47+
import React from 'react';
48+
import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';
49+
import { MePermissionsProvider, type MePermissionsAuthenticatedResponse } from '@object-ui/permissions';
50+
import { LookupField } from './LookupField';
51+
52+
const TARGET = 'crm_account';
53+
54+
const field = {
55+
name: 'account',
56+
label: 'Account',
57+
reference: TARGET,
58+
reference_field: 'name',
59+
} as any;
60+
61+
const realInnerWidth = Object.getOwnPropertyDescriptor(window, 'innerWidth');
62+
const realMatchMedia = window.matchMedia;
63+
64+
function setViewportWidth(width: number) {
65+
Object.defineProperty(window, 'innerWidth', { writable: true, configurable: true, value: width });
66+
window.matchMedia = ((query: string) => ({
67+
matches: window.innerWidth < 768,
68+
media: query,
69+
onchange: null,
70+
addEventListener: () => {},
71+
removeEventListener: () => {},
72+
addListener: () => {},
73+
removeListener: () => {},
74+
dispatchEvent: () => false,
75+
})) as any;
76+
}
77+
78+
beforeEach(() => setViewportWidth(390));
79+
80+
afterEach(() => {
81+
cleanup();
82+
if (realInnerWidth) Object.defineProperty(window, 'innerWidth', realInnerWidth);
83+
window.matchMedia = realMatchMedia;
84+
});
85+
86+
function makeDataSource(shown: number, total: number) {
87+
const rows = Array.from({ length: total }, (_, i) => ({ id: `acc_${i + 1}`, name: `Account ${String(i + 1).padStart(2, '0')}` }));
88+
return {
89+
find: vi.fn().mockImplementation(async () => ({ data: rows.slice(0, shown), total })),
90+
findOne: vi.fn(),
91+
create: vi.fn(),
92+
update: vi.fn(),
93+
delete: vi.fn(),
94+
};
95+
}
96+
97+
const deniedCreate: MePermissionsAuthenticatedResponse = {
98+
authenticated: true,
99+
userId: 'u-reader',
100+
tenantId: null,
101+
hasAnyQueue: false,
102+
objectsUsingQueues: [],
103+
positions: ['reader'],
104+
permissionSets: ['reader'],
105+
objects: { [TARGET]: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false } },
106+
fields: {},
107+
};
108+
109+
async function open(opts: { perms?: MePermissionsAuthenticatedResponse; onChange?: (v: unknown) => void } = {}) {
110+
const ds = makeDataSource(25, 60);
111+
const widget = (
112+
<LookupField field={field} value={undefined} onChange={opts.onChange ?? vi.fn()} readonly={false} dataSource={ds as any} />
113+
);
114+
render(opts.perms ? <MePermissionsProvider initialPermissions={opts.perms}>{widget}</MePermissionsProvider> : widget);
115+
await act(async () => {
116+
fireEvent.click(screen.getByTestId('lookup-trigger-account'));
117+
});
118+
}
119+
120+
describe('LookupField opens its candidate panel in a bottom drawer on a phone (objectstack#36832)', () => {
121+
it('phone width: the trigger opens the drawer, and no popover', async () => {
122+
await open();
123+
expect(await screen.findByTestId('lookup-drawer')).toBeInTheDocument();
124+
expect(screen.queryByTestId('lookup-popover')).toBeNull();
125+
});
126+
127+
it('CONTROL — desktop width: the trigger opens the popover, and no drawer', async () => {
128+
setViewportWidth(1280);
129+
await open();
130+
expect(await screen.findByTestId('lookup-popover')).toBeInTheDocument();
131+
expect(screen.queryByTestId('lookup-drawer')).toBeNull();
132+
});
133+
134+
it('the drawer holds the search row, the listbox and the pinned footer, create and "show all" outside the listbox', async () => {
135+
await open();
136+
const drawer = await screen.findByTestId('lookup-drawer');
137+
await waitFor(() => expect(within(drawer).getAllByRole('option')).toHaveLength(25));
138+
const listbox = within(drawer).getByRole('listbox');
139+
expect(within(drawer).getByRole('combobox')).toHaveAttribute('aria-controls', listbox.id);
140+
const footer = within(drawer).getByTestId('lookup-panel-footer');
141+
const create = within(footer).getByTestId('lookup-create-new');
142+
const showAll = within(footer).getByTestId('show-all-results');
143+
expect(listbox).not.toContainElement(create);
144+
expect(listbox).not.toContainElement(showAll);
145+
expect(listbox.compareDocumentPosition(footer) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
146+
// The drawer is titled with the field's label.
147+
expect(within(drawer).getByText('Account', { selector: 'h2' })).toBeInTheDocument();
148+
});
149+
150+
it('a user without create on the target sees no create row in the drawer', async () => {
151+
await open({ perms: deniedCreate });
152+
const drawer = await screen.findByTestId('lookup-drawer');
153+
await waitFor(() => expect(within(drawer).getAllByRole('option')).toHaveLength(25));
154+
expect(within(drawer).queryByTestId('lookup-create-new')).toBeNull();
155+
expect(within(drawer).queryByText(/Create new/)).toBeNull();
156+
// "show all" still has somewhere to go, so the footer stays for it.
157+
expect(within(within(drawer).getByTestId('lookup-panel-footer')).getByTestId('show-all-results')).toBeInTheDocument();
158+
});
159+
160+
it('picking a candidate in the drawer fills the field and closes the drawer', async () => {
161+
const onChange = vi.fn();
162+
await open({ onChange });
163+
const drawer = await screen.findByTestId('lookup-drawer');
164+
await waitFor(() => expect(within(drawer).getAllByRole('option')).toHaveLength(25));
165+
const last = within(drawer).getAllByRole('option')[24];
166+
await act(async () => {
167+
fireEvent.click(last);
168+
});
169+
expect(onChange).toHaveBeenCalledWith('acc_25');
170+
// Closed: gone, or (while vaul plays its exit) marked closed.
171+
await waitFor(() => {
172+
const after = screen.queryByTestId('lookup-drawer');
173+
expect(after === null || after.getAttribute('data-state') === 'closed').toBe(true);
174+
});
175+
});
176+
177+
it('the search box is not focused when the drawer opens', async () => {
178+
await open();
179+
const drawer = await screen.findByTestId('lookup-drawer');
180+
await waitFor(() => expect(within(drawer).getAllByRole('option')).toHaveLength(25));
181+
expect(within(drawer).getByRole('combobox')).not.toHaveFocus();
182+
});
183+
});

‎ui/packages/fields/src/widgets/LookupField.tsx‎

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import { cn,
88
AvatarImage,
99
Popover,
1010
PopoverTrigger,
11-
PopoverContent, EmptyValue } from '@object-ui/components';
11+
PopoverContent,
12+
Drawer,
13+
DrawerTrigger,
14+
DrawerContent,
15+
DrawerTitle,
16+
useIsMobile, EmptyValue } from '@object-ui/components';
1217
import { Search, X, Loader2, AlertCircle, Plus, TableProperties } from 'lucide-react';
1318
import { FieldWidgetComponentProps } from './types.js';
1419
import { toDomProps } from './toDomProps.js';
@@ -370,6 +375,10 @@ function OptionPreviewLine({ children }: { children: React.ReactNode }) {
370375
export function LookupField({ value, onChange, field, readonly, error: fieldError, inCell, onCommit, ...props }: FieldWidgetComponentProps<any>) {
371376
// objectstack#35688 — in a list cell the candidate list is open from the start.
372377
const [isOpen, setIsOpen] = useState(!!inCell);
378+
// Below the phone breakpoint the candidate panel opens in a bottom drawer
379+
// instead of the anchored popover (objectstack#36832), at the width the
380+
// search-first variant's own sheet switches at.
381+
const isMobile = useIsMobile();
373382
const { t } = useFieldTranslation();
374383
const scanOffered = useFieldScanOffered();
375384
// Same two i18n channels RecordPickerDialog reads, so the inline dropdown
@@ -1999,17 +2008,18 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
19992008
<ScanFieldButton onScan={handleScanned} />
20002009
) : null;
20012010

2002-
// The candidate panel: the popover's body, or the list cell's editor itself.
2011+
// The candidate panel: the popover's body, the phone drawer's body, or the
2012+
// list cell's editor itself.
20032013
//
2004-
// In the popover the search row is pinned at the top, the options scroll in
2005-
// the middle, and "show all results" and quick-create sit in a footer pinned
2006-
// under the list (objectstack#36825). Inside the room Radix reports the list
2014+
// In the popover and the drawer the search row is pinned at the top, the
2015+
// options scroll in the middle, and "show all results" and quick-create sit
2016+
// in a footer pinned under the list (objectstack#36825). Inside the room Radix reports the list
20072017
// is what gives way, so they stay whole and clickable whatever its length,
20082018
// on either side the popover opens to. The footer reads the same `canCreate`
20092019
// as the empty state's create button, and is not drawn when it would hold
20102020
// nothing. The list cell's editor keeps both at the end of its list, above
20112021
// its own pinned rows.
2012-
const panelFace: 'popover' | 'cell' = inCell && !props.disabled ? 'cell' : 'popover';
2022+
const panelFace: 'popover' | 'drawer' | 'cell' = inCell && !props.disabled ? 'cell' : isMobile ? 'drawer' : 'popover';
20132023
const offersShowAll = hasDataSource && totalCount > filteredOptions.length;
20142024
const showAllButton = offersShowAll ? (
20152025
<button
@@ -2040,12 +2050,19 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
20402050
const listShowsOptions = !error && !(loading && filteredOptions.length === 0) && visibleOptions.length > 0;
20412051
// One row under the list: quick-create on the left (its typed name cut
20422052
// short when long), "show all" on the right.
2043-
const pinnedFooter = panelFace === 'popover' && listShowsOptions && (showAllButton || createButton) ? (
2044-
<div className="flex shrink-0 items-center gap-1 border-t p-1 [&>button]:w-auto" data-testid="lookup-panel-footer">
2053+
const pinnedFooter = panelFace !== 'cell' && listShowsOptions && (showAllButton || createButton) ? (
2054+
<div
2055+
className={cn(
2056+
'flex shrink-0 items-center gap-1 border-t p-1 [&>button]:w-auto',
2057+
panelFace === 'drawer' && 'pb-[max(0.25rem,env(safe-area-inset-bottom))]',
2058+
)}
2059+
data-testid="lookup-panel-footer"
2060+
>
20452061
{createButton ?? <span className="flex-1" aria-hidden="true" />}
20462062
{showAllButton}
20472063
</div>
20482064
) : null;
2065+
const fadeFrom = panelFace === 'drawer' ? 'from-background' : 'from-popover';
20492066
const lookupPanelBody = (
20502067
<>
20512068
{/* Search input — not offered on a target whose search resolves to
@@ -2103,10 +2120,16 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
21032120

21042121
{/* Options list */}
21052122
{!error && !(loading && filteredOptions.length === 0) && (
2106-
<div className="relative flex min-h-0 flex-col">
2123+
<div className={cn('relative flex min-h-0 flex-col', panelFace === 'drawer' && 'flex-1')}>
21072124
<div
21082125
ref={attachList}
2109-
className="max-h-64 min-h-0 scroll-py-6 overflow-y-auto px-1 pb-1"
2126+
// The drawer's list takes the height left between the search row
2127+
// and the footer, and scrolls natively there; the popover's keeps
2128+
// its cap and shrinks into the room Radix reports.
2129+
className={cn(
2130+
'min-h-0 scroll-py-6 overflow-y-auto px-1 pb-1',
2131+
panelFace === 'drawer' ? 'flex-1 overscroll-contain' : 'max-h-64',
2132+
)}
21102133
role="listbox"
21112134
id={listboxId}
21122135
onScroll={readListMore}
@@ -2196,7 +2219,7 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
21962219
)}
21972220
{/* The list cell's editor keeps "show all" (opens the full
21982221
Record Picker, Level 2) and quick-create at the end of its
2199-
list; the popover pins them below it. */}
2222+
list; the popover and the drawer pin them below it. */}
22002223
{panelFace === 'cell' && showAllButton}
22012224
{panelFace === 'cell' && createButton}
22022225
</>
@@ -2205,14 +2228,14 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
22052228
{listMore.above && (
22062229
<div
22072230
aria-hidden="true"
2208-
className="pointer-events-none absolute inset-x-0 top-0 h-6 bg-gradient-to-b from-popover to-transparent"
2231+
className={cn('pointer-events-none absolute inset-x-0 top-0 h-6 bg-gradient-to-b to-transparent', fadeFrom)}
22092232
data-testid="lookup-list-more-above"
22102233
/>
22112234
)}
22122235
{listMore.below && (
22132236
<div
22142237
aria-hidden="true"
2215-
className={cn('pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-popover to-transparent', !pinnedFooter && 'rounded-b-md')}
2238+
className={cn('pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t to-transparent', !pinnedFooter && 'rounded-b-md', fadeFrom)}
22162239
data-testid="lookup-list-more-below"
22172240
/>
22182241
)}
@@ -2438,10 +2461,42 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
24382461
</div>
24392462
) : (
24402463
<div className="flex items-center gap-1.5">
2441-
{/* `modal`: the popover is its own scroll-lock layer. Portalled out of
2442-
a modal form's DOM, a non-modal popover's list sits outside that
2443-
dialog's scroll lock, which cancels every wheel and touch move on
2444-
it; as the topmost lock its list scrolls (objectstack#36825). */}
2464+
{panelFace === 'drawer' ? (
2465+
// The phone face (objectstack#36832): a bottom drawer, its own modal
2466+
// layer, so the list scrolls by touch even when the field sits in a
2467+
// modal form. The search row stays at the top, the list takes the
2468+
// height between it and the pinned footer, and the drawer follows the
2469+
// on-screen keyboard (vaul's `repositionInputs`). The search box is not
2470+
// focused on open, so the keyboard does not cover the list until the
2471+
// user asks to type.
2472+
<Drawer
2473+
open={isOpen}
2474+
onOpenChange={(o) => {
2475+
if (!dependenciesMissing) setIsOpen(o);
2476+
}}
2477+
shouldScaleBackground={false}
2478+
>
2479+
<DrawerTrigger asChild>
2480+
{triggerButton}
2481+
</DrawerTrigger>
2482+
<DrawerContent
2483+
className="h-[85dvh] max-h-[85dvh] outline-none"
2484+
aria-describedby={undefined}
2485+
data-testid="lookup-drawer"
2486+
>
2487+
<DrawerTitle className="shrink-0 truncate px-4 pt-3 text-base font-semibold">
2488+
{lookupField?.label || t('common.select')}
2489+
</DrawerTitle>
2490+
<div className="flex min-h-0 flex-1 flex-col">
2491+
{lookupPanelBody}
2492+
</div>
2493+
</DrawerContent>
2494+
</Drawer>
2495+
) : (
2496+
// `modal`: the popover is its own scroll-lock layer. Portalled out of
2497+
// a modal form's DOM, a non-modal popover's list sits outside that
2498+
// dialog's scroll lock, which cancels every wheel and touch move on
2499+
// it; as the topmost lock its list scrolls (objectstack#36825).
24452500
<Popover
24462501
modal
24472502
open={isOpen}
@@ -2472,6 +2527,7 @@ export function LookupField({ value, onChange, field, readonly, error: fieldErro
24722527
{lookupPanelBody}
24732528
</PopoverContent>
24742529
</Popover>
2530+
)}
24752531

24762532
{lookupScan}
24772533
{singleClear}

0 commit comments

Comments
 (0)