fix(x-select): make .value reflect the current selection#263
Merged
Conversation
x-select's `.value` returned the value ATTRIBUTE, which a user selection never updates (only the inner <select> + the dispatched select-change event changed). So consumers that read `el.value` — x-form's collect-values, the demo's status filter — saw a stale value: the filter looked dead, and forms silently submitted the pre-selection value. Every other BareDOM form control makes `.value`/`.checked` reflect the current value (the contract x-form relies on); x-select was the lone exception. Override its `value` getter to read the live inner <select>, with one disambiguation: a non-empty value set BEFORE its <option> exists (async-loaded options) is surfaced as pending via the attribute until the option arrives. This preserves both existing tests (value-attr-not-auto-set-on-change, string-property-value) and adds two regression tests (selection reflection; set-before-options). clj-kondo clean; full karma 5190. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
avanelsas
added a commit
that referenced
this pull request
Jun 4, 2026
Carries the x-select .value-reflection fix (#263) into the write-side alpha channel. Element surface unchanged from 4.0.0-alpha.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
avanelsas
added a commit
that referenced
this pull request
Jun 10, 2026
Retire BareBuild entirely from the BareDOM repo. Removes the read-side orchestration elements (barebuild-router / barebuild-route / barebuild-data), the BareBuild CLI generator + project template, the Phase-4 demo app, all BareBuild docs, and reverts the alpha (pre-release) dist-tag CI lane (#261). Removed merged work: #252, #253, #256, #258, #259, #260, #261. Preserved: #257 (unrelated x-form/x-select fix) and #263 (x-select .value), which only happened to land in the same window. The seam was clean (CI-enforced via the now-removed scripts/check-barebuild-boundary.bb): no non-BareBuild component imported any BareBuild code, so this is deletion + reference-block edits only. Reference edits: - registry.cljs / core.cljs: drop barebuild-registers - shadow-cljs.edn / package.json: drop the barebuild-* ESM modules + exports - public/index.html / README.md / docs/components.md: drop the Orchestration category (now empty) - scripts/generate_types.bb / metadata.bb: type only x-* again - .github/workflows/ci.yml: drop the boundary check + demo-app E2E job - .github/workflows/release.yml + docs/RELEASING.md: revert the #261 alpha lane - custom-elements.json: regenerated (no barebuild entries) - CLAUDE.md / src/baredom/utils/dom.cljs: scrub barebuild from inline examples Verified: clj-kondo 0/0, release lib 0 warnings, compile test 0 warnings, npm test 5096 passing, require-style / du-discipline / method-api / bundle-size guards all green. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
x-select.valuereturned the value attribute, which a user selection never updates (only the inner<select>+ the dispatchedselect-changeevent change). So any consumer readingel.valuesaw a stale value:(.-value sel)→ never sees the selection → looks dead.x-form'scollect-valuesreads(.-value field)at submit and doesn't listen forselect-change→ forms silently submit the pre-selection value forx-selectfields (latent; no e2e selected an option before submitting).x-selectwas the only form control like this —x-form-field,x-checkbox,x-date-picker, etc. all make.value/.checkedreflect the current value, which is the contractx-formrelies on (and native<select>.valuebehaviour).Fix
Override
x-select'svaluegetter to read the live inner<select>, with one disambiguation: a non-empty value set before its<option>exists (async-loaded options) is surfaced as pending via the attribute until the option arrives andapply-model!selects it.This preserves both existing tests unmodified:
value-attr-not-auto-set-on-change-test— a user change still updates only the inner<select>, never the attribute.string-property-value-test—el.valueset before options reads back from the attribute.And adds two regression tests: selection reflection, and set-before-options pending→resolves.
Verification
clj-kondocleanx-form/x-selectregressions)Stable-component fix → targets
main. (Already cherry-picked onto the alpha branch so the demo's filter works there too.)🤖 Generated with Claude Code