Skip to content

Carry standalone form-control inputs as runtime islands (clears unsupported_input)#244

Merged
chubes4 merged 1 commit into
trunkfrom
cook/php-transformer-standalone-input-coverage
Jun 28, 2026
Merged

Carry standalone form-control inputs as runtime islands (clears unsupported_input)#244
chubes4 merged 1 commit into
trunkfrom
cook/php-transformer-standalone-input-coverage

Conversation

@chubes4

@chubes4 chubes4 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

Adds deterministic coverage for standalone <input> (and <select>/<textarea>) elements outside a <form>, eliminating the last unsupported_input / html_unsupported_element family from the corpus.

Driven by the corpus survey: all 6 unsupported_input occurrences (6 fixtures) were the same kind — hidden <input type="file"> JSON-import pickers driven by client scripts (e.g. 58-infinite-whiteboard, 59-spreadsheet, 64-kanban-board). They are invisible (hidden/display:none/aria-hidden), reached the html_unsupported_element catch-all, and produced an UNACCEPTABLE unsupported_element_loss.

Change (src/HtmlToBlocks/HtmlTransformer.php)

  • New preserveStandaloneFormControlAsRuntimeIsland(), hooked into convertElement after the readable-control / search paths decline and before the unsupported fallback. For standalone non-readable controls (file/hidden/color/date, or any control carrying inline event handlers) it records a runtime island (control, form_control_requires_runtime) with the source markup carried, and emits no misleading static text.
  • Resulting loss class is preserved_runtime_island (ACCEPTABLE, with the runtime carried) instead of unsupported_element_loss.
  • Readable inputs (text/email/number/search/checkbox/radio/range/tel/url/submit) are unchanged — still core/paragraph editable_approximation or core/search native_conversion.

Verification

  • composer test + composer parity → green, 126 fixtures (+1 new: html-standalone-input-runtime-island-preserved.json, asserting 0 blocks / 0 fallbacks, a control runtime island with carried snippet, loss_class = runtime_island_preserved).
  • Corpus re-run: unsupported_input family 6 → 0; html_unsupported_element overall 53 → 47 (remaining 47 are figure/marquee/noscript/blink/label, covered by PR Add deterministic figure + long-tail static-tag coverage #236).

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Claude Opus 4.8, 1M context)
  • Used for: Drafting the implementation, fixture, and corpus verification under human review.

… as runtime islands

Standalone <input> elements that have no faithful native block or readable
static approximation (file/hidden/color/date-style inputs, or any control with
inline event handlers) previously fell through to the unsupported-element
fallback, producing an unacceptable unsupported_element_loss (the
unsupported_input pattern family). The corpus survey showed this as the only
remaining html_unsupported_element input family: 6 occurrences across 6 website
fixtures, all hidden JSON-import file pickers driven by client scripts.

These controls genuinely depend on a client runtime and, when hidden, have no
visual representation. Forcing a static paragraph approximation would be wrong.
Instead, after the readable-control and search paths decline, preserve the
control as a bounded runtime island: the source markup is carried in the island
snippet so behavior can be re-attached, no misleading static block is emitted,
and the outcome is the acceptable runtime_island_preserved loss class rather
than unsupported_element_loss.

Corpus impact: unsupported_input 6 -> 0; html_unsupported_element 53 -> 47;
unsupported_element_loss total 53 -> 47. Adds a dedicated parity fixture
asserting the runtime-island outcome and acceptable loss class. Change is
additive and localized to input handling to merge cleanly with the in-flight
figure/long-tail coverage PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chubes4 chubes4 merged commit 85d99be into trunk Jun 28, 2026
1 check passed
@chubes4 chubes4 deleted the cook/php-transformer-standalone-input-coverage branch June 28, 2026 01:22
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