Skip to content

Support controlled select values behind an opt-in define - #10

Merged
back2dos merged 4 commits into
MVCoconut:masterfrom
serjek:fix/react-dom-attributes
Oct 25, 2026
Merged

back2dos merged 4 commits into
MVCoconut:masterfrom
serjek:fix/react-dom-attributes

Conversation

@serjek

@serjek serjek commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Controlled <select value="..."> templates currently fail to compile because React's value prop is absent from the HTML select attributes supplied by tink_domspec.

Add -D coconut_react_dom_select_value to opt into a select value prop accepting a string or an array of strings for multiple selection. This allows selection to follow application state, including programmatic resets. Default behavior stays unchanged.

The define and README make the portability limitation explicit: coconut.html and coconut.vdom use selected on individual options and cannot consume these templates unchanged.

Validation: ordinary selects compile without the define; controlled single and multiple selects compile with it; controlled values are rejected without it. The consuming frontend's browser integration checks previously covered controlled select resets and reactive inputs.

ARIA definitions remain in tink_domspec, covered separately by tink_domspec PR #43.

@serjek serjek changed the title Fix ARIA attributes and controlled select values Support controlled select values Oct 22, 2026
@back2dos

Copy link
Copy Markdown
Member

I'm a bit split about this. Setting aside my distaste for React so often deviating from the DOM APIs, the bigger issue is that it invites code that is incompatible with:

  • coconut.vdom: probably irrelevant, but easy to fix
  • coconut.html: relevant for full stack with proper hydration, unless one is willing to commit to React on the server side as well ... but a bit harder to fix

Will see if Claude can solve the latter. Otherwise I would put this under a define, so that users opt into the stumbling block.

@serjek serjek changed the title Support controlled select values Support controlled select values behind an opt-in define Oct 23, 2026
@serjek
serjek marked this pull request as draft October 23, 2026 17:38
@serjek

serjek commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Yes good point! I see if we can avoid this change at all.

@serjek serjek closed this Oct 23, 2026
@back2dos back2dos reopened this Oct 24, 2026
coconut.vdom and coconut.html now support it the same way, so the
templates stay portable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@back2dos
back2dos marked this pull request as ready for review October 25, 2026 11:04
@back2dos
back2dos merged commit 1c9e5f2 into MVCoconut:master Oct 25, 2026
@back2dos

Copy link
Copy Markdown
Member

Works fine now. It was just a bit finnicky for coconut.html. The v1 branch goes through strings and tries to flatten as much as possible at compile time, so select and option needed an exemption, but it turned out quite claudable.

@serjek

serjek commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!

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.

2 participants