Repository navigation
Commit 97e0f93
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
- .changeset
- ui/packages/fields/src/widgets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| |||
370 | 375 | | |
371 | 376 | | |
372 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
373 | 382 | | |
374 | 383 | | |
375 | 384 | | |
| |||
1999 | 2008 | | |
2000 | 2009 | | |
2001 | 2010 | | |
2002 | | - | |
| 2011 | + | |
| 2012 | + | |
2003 | 2013 | | |
2004 | | - | |
2005 | | - | |
2006 | | - | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
2007 | 2017 | | |
2008 | 2018 | | |
2009 | 2019 | | |
2010 | 2020 | | |
2011 | 2021 | | |
2012 | | - | |
| 2022 | + | |
2013 | 2023 | | |
2014 | 2024 | | |
2015 | 2025 | | |
| |||
2040 | 2050 | | |
2041 | 2051 | | |
2042 | 2052 | | |
2043 | | - | |
2044 | | - | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
2045 | 2061 | | |
2046 | 2062 | | |
2047 | 2063 | | |
2048 | 2064 | | |
| 2065 | + | |
2049 | 2066 | | |
2050 | 2067 | | |
2051 | 2068 | | |
| |||
2103 | 2120 | | |
2104 | 2121 | | |
2105 | 2122 | | |
2106 | | - | |
| 2123 | + | |
2107 | 2124 | | |
2108 | 2125 | | |
2109 | | - | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
2110 | 2133 | | |
2111 | 2134 | | |
2112 | 2135 | | |
| |||
2196 | 2219 | | |
2197 | 2220 | | |
2198 | 2221 | | |
2199 | | - | |
| 2222 | + | |
2200 | 2223 | | |
2201 | 2224 | | |
2202 | 2225 | | |
| |||
2205 | 2228 | | |
2206 | 2229 | | |
2207 | 2230 | | |
2208 | | - | |
| 2231 | + | |
2209 | 2232 | | |
2210 | 2233 | | |
2211 | 2234 | | |
2212 | 2235 | | |
2213 | 2236 | | |
2214 | 2237 | | |
2215 | | - | |
| 2238 | + | |
2216 | 2239 | | |
2217 | 2240 | | |
2218 | 2241 | | |
| |||
2438 | 2461 | | |
2439 | 2462 | | |
2440 | 2463 | | |
2441 | | - | |
2442 | | - | |
2443 | | - | |
2444 | | - | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
2445 | 2500 | | |
2446 | 2501 | | |
2447 | 2502 | | |
| |||
2472 | 2527 | | |
2473 | 2528 | | |
2474 | 2529 | | |
| 2530 | + | |
2475 | 2531 | | |
2476 | 2532 | | |
2477 | 2533 | | |
| |||
0 commit comments