Repository navigation
Commit 586a7ed
fix(app-shell): Enter after a field type search picks the type the search names (#26259)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9B2qu4S8m6QxptyXivYdzJu)_
Fixes #26194
Part of #26059
Clause-②: no
Metadata-protocol: none
## What
In Studio's Add field popover and the field inspector, `FieldTypePicker`
now highlights, for a non-empty query, the first listed type the query
**names** (by its shown name, its id, its id with underscores as spaces,
or the catalog's English name), and the first listed type when the query
names none. Enter picks the highlighted type, so on a Phone field typing
"Number" and pressing Enter commits Number.
With an empty query the current type is highlighted and scrolled into
view as before, and re-choosing it still commits nothing. Clearing a
query highlights the current type again. The arrow keys move on from the
highlighted type.
## The mechanism, measured (the card's hypothesis did not hold)
The card's hypothesis was that the `defaultValue` given to `Command`
kept the current type highlighted while the list filtered. That is not
what happens. cmdk 1.1.1 re-highlights the **first rendered row** on
every search change, also under `shouldFilter={false}`. The current type
stayed highlighted only because it was the first row: Phone's
description, "A phone number.", holds "number" as a whole word, so
objectui#12516's search keeps Phone, and its Text group comes before the
Number group. Highlighting "the first match" (the first row) therefore
cannot satisfy the card's own acceptance test. The fix follows the
ruling's intent (Enter picks the type you typed) without reordering the
list, which objectui#12516 pins in catalog order.
How: `Command` is now controlled (`value` / `onValueChange`). A search
change clears the highlight and records the target the new query asks
for. cmdk's own first-row pick then arrives through `onValueChange` and
is replaced by that target once. Arrow keys and pointer moves arrive the
same way and are taken as they come. The `matches` predicate is split
into `names` (name, id, English name) plus the category and description
arms; what a query lists is unchanged.
## Tests
New `FieldTypePicker.enterPicksFirstMatch-26194.test.tsx`, five cases:
Phone + "Number" + Enter commits Number (and Phone is still the first
listed row); empty query highlights Phone and Enter commits nothing;
clearing the query highlights Phone again; ArrowDown from the
highlighted match moves to the next row and Enter commits it; "masked"
(description-only match) highlights the first row, Password.
- Red leg, the base `FieldTypePicker.tsx` (6862ef6) with the new test:
`Tests 3 failed | 2 passed (5)`, each failure `expected [ 'phone' ] to
deeply equal [ 'number' ]` (and the arrow case one row behind). The
restore was checked by `git diff HEAD` empty and the blob hash equal to
HEAD's.
- Green leg at ae665e4: the 28 test files that render the picker, the
inspector or the Add field popover (`FieldTypePicker*`,
`ObjectFieldInspector*`, `DataPillar.addFieldPopover-12516`,
`ObjectFormDesigner.typeName-13148`, and every test file naming the
picker): `Test Files 28 passed (28)`, `Tests 304 passed (304)`.
- `pnpm --filter @object-ui/app-shell type-check` (both `tsc --noEmit`
and `tsconfig.test.json`), after building the closure: exit 0.
- The full app-shell suite is left to CI `Test UI` (declared narrowing;
the package is too large to run locally).
## Gates
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 35 derived families, each run, every one
`exit 0`; `--ran` reconciliation: "35 run, 0 NOT-MEASURED (a DERIVED
zero …)". Re-run on the merged head 8d468f4 (merge of `origin/main`,
derivation unchanged). Every family CI runs is read from this PR's check
runs.
## Acceptance notes
- Surface is exactly the claim's: `FieldTypePicker.tsx`, one new sibling
test, one root changeset (`patch` for `@object-ui/app-shell`). No
registry package, no sdui record.
- The same first-row pick also meant that on a field of another type,
"Number" + Enter would commit Phone rather than Number. That follows
from the measured first-row pick and was not run separately; this PR
covers it, as the same defect.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01NWnUGWJGbeTmGLWfrfWFXB
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 443f563 commit 586a7ed
3 files changed
Lines changed: 188 additions & 23 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views/metadata-admin/inspectors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
131 | 140 | | |
132 | 141 | | |
133 | 142 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
139 | 157 | | |
140 | 158 | | |
141 | 159 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
150 | 180 | | |
151 | 181 | | |
152 | 182 | | |
| |||
172 | 202 | | |
173 | 203 | | |
174 | 204 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 205 | + | |
| 206 | + | |
183 | 207 | | |
184 | 208 | | |
185 | 209 | | |
186 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
187 | 234 | | |
188 | 235 | | |
189 | 236 | | |
| |||
212 | 259 | | |
213 | 260 | | |
214 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
215 | 266 | | |
216 | 267 | | |
217 | 268 | | |
| |||
244 | 295 | | |
245 | 296 | | |
246 | 297 | | |
247 | | - | |
| 298 | + | |
| 299 | + | |
248 | 300 | | |
249 | 301 | | |
250 | 302 | | |
251 | 303 | | |
252 | | - | |
| 304 | + | |
253 | 305 | | |
254 | 306 | | |
255 | 307 | | |
| |||
0 commit comments