Skip to content

fix: lay out inline date pickers built in DSL blocks - #68

Merged
AdamMusa merged 1 commit into
mainfrom
fix/inline-date-picker-in-blocks
Nov 6, 2026
Merged

AdamMusa merged 1 commit into
mainfrom
fix/inline-date-picker-in-blocks

Conversation

@AdamMusa

@AdamMusa AdamMusa commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Problem

The v0.0.23 → main compatibility audit found that an inline date picker is silently dropped from DSL blocks.

PropControls.attach keys only on the wire type, so it treats the inline picker as an overlay. It is kept only when it is the return value of a Ruflet.* (WidgetBuilder) block or passed through children:/controls::

pattern v0.0.23 main
Ruflet.column { cupertino_date_picker; text("below") } [DatePicker, Text] [Text]
column { text("label"); cupertino_date_picker } (Kernel) [Text, DatePicker] [Text]
Ruflet.column { Ruflet.text("label"); Ruflet.cupertino_date_picker; Ruflet.text("after") } [Text] (pre-#50) [Text, Text]
column { date_picker(inline: true); text } ArgumentError [Text]
page.mount { column { cupertino_date_picker; text } } DatePicker on the wire no DatePicker on the wire

Argument form (column(children: [cupertino_date_picker, text])) already worked on main, so the two forms disagreed.

Audit evidence: compat/surface/inline_picker_probe.rb and compat/risk/probes/p05b_cdp_block.rb.

Why it matters for existing apps

Blocks are the documented way to build layouts (column(children=nil, **props, &block), page.mount(&block)). An app that puts a cupertino_date_picker in a block gets nothing on screen: no error, no events. At v0.0.23 the picker was at least mounted as a child (it could be opened with page.update(picker, open: true)). With #62 and the current engine it should now render in place, but in block form it never reaches the wire.

Fix

Page.presented_control? returns false for a DatePicker whose inline prop is true. The picker is then laid out like any other control (the same treatment as Picker, TimerPicker and ActionSheet). A dialog date_picker, with no inline or inline: false (including cupertino_date_picker(inline: false)), stays a presented overlay. PRESENTED_TYPES is unchanged.

No engine change is needed. On codex/engine-initialization, cupertino_date_picker_dialog.dart builds the inline CupertinoDatePicker when getBool("inline") is true (ruby_date_picker_inline_test.dart).

Tests

  • New packages/ruflet_core/test/dsl_inline_date_picker_test.rb (9 tests):
    • captured in Ruflet.column blocks, with Ruflet.* helpers, with bare Kernel helpers, in DSL.app blocks and roots, and with date_picker(inline: true);
    • the dialog variants are still not captured;
    • page.mount with a nested block sends exactly one DatePicker, and a top-level page.mount lays it out;
    • the inline picker built in a block receives its change event;
    • unit checks of presented_control?.
    • On main: 9 of 9 fail.
  • Existing dsl_presented_controls_test.rb still passes. A plain date_picker in a block is still not captured, and DatePicker stays in PRESENTED_TYPES. cupertino_date_picker_compatibility_test.rb also still passes.
  • All suites pass: ruflet_core, ruflet_server, ruflet (CLI) and ruflet_rails, each run per file.

Doc-example harness

I ran all 183 documented examples on this branch and compared them with the v0.0.23 baseline outputs, ignoring tree_probe: 0 differ (180 identical, 3 skipped, as on main). No documented example uses an inline picker in block form, so none had to change.

On this branch the audit probe p05b_cdp_block gives back the baseline trees for every block form. The only differences from baseline are intended:

inline_picker_probe.rb now reports page.mount wire contains DatePicker: true.

Page::PRESENTED_OVERLAY_TYPES (#50) lists the DatePicker wire type, and
#62 made cupertino_date_picker (and date_picker(inline: true)) send that
wire type with inline: true so the engine draws it in place. DSL blocks
skip presented overlays when they capture children, so an inline picker
written as a block statement was silently dropped:
`column { cupertino_date_picker; text("below") }` had only the text, and
page.mount sent no DatePicker. v0.0.23 kept it as a column child.

Page.presented_control? now treats a DatePicker whose inline prop is true
as an ordinary control. A dialog date_picker (no inline, or inline: false)
stays a presented overlay.
@AdamMusa
AdamMusa merged commit 730add7 into main Nov 6, 2026
13 of 14 checks passed
AdamMusa pushed a commit that referenced this pull request Nov 7, 2026
Brings in #64 (reclaim only from child-control slots), #65 and #66
(Dropdown change event name and spellings) and #68 (inline date pickers
in DSL blocks).

Conflicts:
- Page.presented_control?: #68 and this branch both exempt inline date
  pickers; kept this branch's inline_overlay? rule (any presented
  overlay built with inline: true), which #68's new tests also pass.
- PropControls.reclaim: kept #64's child-slot walk and mounted-control
  rule together with this branch's last-first order; the comment covers
  both. Page#claim_prop_control now passes its value as a one-slot props
  hash, since reclaim reads props.
- Dropdown contract and its test file: both sides' additions kept.

ruflet_core 186/186 files (1039 runs), ruflet_rails 16/16, ruflet_record
5/5; ruflet_server and ruflet only the two environment-specific failures
that also fail on main here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant