Skip to content

@dashforge/ui DatePicker inside form: clicking a valid weekday does not commit the value (dash test-calendar section 7) #114

Description

@kensaadi

Symptom

In dash's /test-calendar route, section 7 — Full suite inside a form (bridge + validation), clicking on a valid weekday inside the Start date DatePicker's calendar popup does NOT commit the selected value to the form field. The popup closes but the input stays empty.

Discovered while

Manual visual smoke test during Sprint 5 pre-flight for issue #60 (Option C). Reported by @kensaadi 2026-07-12 during the dash smoke session.

Repro

  1. cd ~/projects/web/learn/dash && pnpm dev (or open http://localhost:5176 with dash already running)
  2. Navigate to /test-calendar
  3. Scroll to section 7 — Full suite inside a form (bridge + validation)
  4. Click the calendar icon on the Start date (required, weekdays only) input → calendar popup opens
  5. Click a valid weekday within the min-max range (e.g. May 15, 2026 — a Friday, not weekend, within minDate='2026-05-01' / maxDate='2026-07-31')
  6. Observe: the calendar popup closes, BUT
  7. The Start date input remains empty — the selected value never gets committed to the form field

Diagnostic evidence (from live session)

Ran during repro:
```js
const day = Array.from(grid.querySelectorAll('button')).find(b => b.textContent?.trim() === '15');
day.click();
// After: input.value === '' (still empty)
// After: popup closes (data-dialog gone)
// After: 0 console errors
```

The day button IS a real button with:

  • disabled: false
  • aria-disabled: 'false'
  • aria-label: 'Friday, May 15, 2026'

But the click:

  • Does NOT call handleCalendarChange → does NOT reach commitValue → does NOT trigger bridge.setValue
  • Does close the popup (ClickAwayListener or a Radix outside-click may be swallowing focus)

What is NOT the cause

  • Not React duplicate: dash uses a single React 19.2.7 instance
  • Not a min/max issue: May 15 2026 is well within the configured range
  • Not isDateDisabled: verified disabled=false on the button
  • Not a bridge issue: same pattern works in section 3 (DatePicker standalone) — the standalone version DOES commit the value (verified by checking `Value: ...` display)

Suspected root cause

Calendar (in @dashforge/ui) day-button `onClick={() => calendar.selectDate(day.iso)}` — the `selectDate` call chain in `useCalendar` (from `@dashforge/calendar-core`) is not firing the parent's `onChange` prop when the value TRANSITIONS from `null` to a valid date inside a form-bridge context. Behavior might be specific to the form-integrated path (`resolvedValue = bridgeValue ?? null`) — the standalone path (section 3) has different value plumbing and works.

Acceptance

  • Identify why `calendar.selectDate(day.iso)` inside section 7's bridge-integrated DatePicker does not propagate the new value to the form field
  • Fix so that clicking a valid weekday commits the value AND closes the popup AND `bridge.setValue` is called
  • Add regression test rendering a `` with a `<DatePicker name='x' rules={{ required: true }} />` inside, asserting that after simulating a day-cell click the RHF value updates
  • Verify the same pattern works for the DateTimePicker + DateRangePicker inside the same form (section 7 has all of them)

Versions

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions