Repository navigation
Commit 2da2979
fix(fields): a click in the record form date box opens the calendar (#36522)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JpRoUZGqtwqMU5k7b4C58D)_
Fixes #36457
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 业务用户在记录新建、编辑表单及复用同一控件的对话框里,点日期输入框本身就会弹出日历;以前只有点右侧小图标才弹,点框只出光标。
- 解决外部试用中用户把日期框当成坏了的体验问题(界面体验专题),替前线业务用户解决。
- 若出错,最坏是日期框点击后日历不弹或焦点位置不对,手输日期与日历图标仍照旧可用;可直接撤回此改动。
- 无
## What changes
`TemporalPicker` in
`ui/packages/fields/src/widgets/date-picker/DatePickerField.tsx` (both
the `date` and the `datetime` face, which share it):
- Outside a grid cell, a click in the text box opens the calendar
popover the calendar button opens.
- The box keeps the focus when the popover opens from it (the popover's
open auto-focus and the calendar's own `autoFocus` are skipped), so
typing still edits the text; the text is still read on Enter or blur, as
before.
- A click or focus in the box is not treated as a click outside, so it
does not close the popover. Enter commits the text and, when it names a
date, closes the popover. Escape closes it and the focus stays in the
box (Radix would otherwise move it to the calendar button). On close,
the focus returns to the box only when nothing else took it.
- Only a click opens it: focus arriving by Tab opens nothing, so tabbing
through a form does not pop a calendar at every date field, and Tab
moves on without entering the popover.
- A11y: the box carries the popover relationship Radix gives the button:
`aria-haspopup="dialog"`, `aria-expanded`, and `aria-controls` naming
the popover while open. The button keeps its label; its `aria-controls`
now names the same popover id.
- The calendar button is unchanged. The grid's in-cell face (`inCell`,
settled by #36023) is not touched: it draws no popover and its box gets
none of the above.
- Placeholder: `parseLocaleDateText` reads digit groups split by any
non-digit, so `/`, `-`, `.` and spaces are all accepted. Left as it is,
per the dispatch.
## Tests
New top-level describe in the existing harness
`DatePickerField-12622.test.tsx` (10 cases): a click in the box opens
the popover, keeps focus in the box and wires `aria-haspopup` /
`aria-expanded` / `aria-controls`; typing keeps it open and a typed date
still writes, Enter commits and closes; a second click keeps it open;
Escape closes and focus stays in the box; a calendar pick after a box
click writes and closes; focus without a click opens nothing; a disabled
box opens nothing; the button still opens it and moves focus into the
calendar; the datetime face opens the same way with its time row;
CONTROL: the in-cell face has no popover relationship and a click opens
nothing.
<details><summary>Local run (head 53e0952, under the shared verify
lock)</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 packages/fields/src/widgets/date-picker/ packages/fields/src/widgets/imeComposition-35996.test.tsx packages/fields/src/widgets/touchTarget.formControls-29072.test.tsx packages/fields/src/__tests__/inCellFaces-35688.test.tsx packages/fields/src/__tests__/inline-widget-aria-invalid-7126.test.tsx packages/fields/src/__tests__/date-picker-invalid-text-blocks-submit-27483.test.tsx packages/plugin-detail/src/__tests__/InlineFieldInput.datetimePicker-12759.test.tsx packages/app-shell/src/views/ScreenView.platformControls-26579.test.tsx
Test Files 9 passed (9)
Tests 141 passed | 4 skipped (145)
os-verify-lock: VERDICT command-exit 0
```
The extra files are every other suite that drives this widget (IME
Enter, touch targets, in-cell faces, aria-invalid, invalid-text submit,
record-page inline editing, screen view controls).
</details>
NOT MEASURED: `pnpm --filter @object-ui/fields type-check` locally,
reason: it needs the `@object-ui/fields^...` dist closure (about fifty
packages) built, under a verify lock that was contended for over an
hour; `Type Check UI` in CI measures it.
NOT MEASURED: ablation of the box click, reason: the first attempt was
refused by `scripts/ablation-replace.mjs` before any test ran (the
replacement text was not distinct, a no-op the tool caught and
restored), and the corrected re-run did not reach the lock before this
PR opened. The report on the card carries the reading if it lands.
## Acceptance notes
- On a phone, the box's `inputMode="numeric"` still raises the soft
keyboard on tap, now together with the calendar. Not changed here:
switching keyboard off would cost keyboard entry, which the dispatch
keeps.
- Other non-grid hosts of this widget get the same behaviour: the record
page's inline details editing (`InlineFieldInput`, via
`FieldEditWidget`), the kanban required-fields dialog, the filter
builder and screen view controls. All are form-like faces, not list
cells.
- Arrow-key entry from the box into the open calendar is not added; the
calendar button remains the keyboard route into the calendar.
## Verification
Read first:
1. `ui/packages/fields/src/widgets/date-picker/DatePickerField.tsx`, the
`PopoverContent` handlers (`onOpenAutoFocus`, `onInteractOutside`,
`onCloseAutoFocus`): the focus and dismissal logic is where a regression
would hide.
2. The same file, the text box `onClick` and the `opensPopover`
argument: confirms the in-cell face is untouched.
3. The new describe in `DatePickerField-12622.test.tsx`.
Two-minute check: in the showcase console, open any object's New dialog
with a date field and click inside the date box. Expect the calendar to
open under the box with the cursor still in the box; type `2026-10-20`
and press Enter; expect the value set and the calendar closed.
Local gates: the 38 commands `node scripts/pm/dispatch-gates.mjs
--commands` derived for this diff, plus `pnpm check:changeset-fixed`,
all exit 0 except `pnpm check:type-check-debt` (NOT MEASURED: its
closure build waits on the same contended lock; CI runs it) and `pnpm
--dir ui exec vitest run scripts/` (left to CI's Test UI).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRY38EZf38Yy3zthbY -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 316f757 commit 2da2979
3 files changed
Lines changed: 192 additions & 7 deletions
File tree
- .changeset
- ui/packages/fields/src/widgets/date-picker
| 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 | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
95 | 105 | | |
96 | 106 | | |
97 | 107 | | |
| |||
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
130 | 145 | | |
131 | 146 | | |
132 | 147 | | |
| |||
188 | 203 | | |
189 | 204 | | |
190 | 205 | | |
| 206 | + | |
191 | 207 | | |
192 | 208 | | |
193 | 209 | | |
194 | 210 | | |
195 | | - | |
| 211 | + | |
196 | 212 | | |
197 | 213 | | |
| 214 | + | |
198 | 215 | | |
199 | 216 | | |
200 | 217 | | |
| |||
251 | 268 | | |
252 | 269 | | |
253 | 270 | | |
254 | | - | |
255 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
256 | 276 | | |
257 | 277 | | |
| 278 | + | |
258 | 279 | | |
259 | 280 | | |
260 | 281 | | |
| |||
274 | 295 | | |
275 | 296 | | |
276 | 297 | | |
277 | | - | |
| 298 | + | |
278 | 299 | | |
279 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
280 | 307 | | |
281 | 308 | | |
282 | 309 | | |
283 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
284 | 315 | | |
285 | 316 | | |
286 | 317 | | |
| |||
294 | 325 | | |
295 | 326 | | |
296 | 327 | | |
297 | | - | |
| 328 | + | |
| 329 | + | |
298 | 330 | | |
299 | 331 | | |
300 | 332 | | |
| |||
396 | 428 | | |
397 | 429 | | |
398 | 430 | | |
399 | | - | |
| 431 | + | |
400 | 432 | | |
401 | 433 | | |
402 | 434 | | |
| |||
411 | 443 | | |
412 | 444 | | |
413 | 445 | | |
414 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
415 | 454 | | |
416 | 455 | | |
417 | 456 | | |
| |||
420 | 459 | | |
421 | 460 | | |
422 | 461 | | |
| 462 | + | |
423 | 463 | | |
424 | 464 | | |
425 | 465 | | |
426 | 466 | | |
427 | 467 | | |
428 | 468 | | |
| 469 | + | |
429 | 470 | | |
430 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
431 | 487 | | |
432 | 488 | | |
433 | 489 | | |
| |||
0 commit comments