LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtSep 19, 2026, 1:29 PM
updatedAtSep 19, 2026, 6:11 PM
githubUrlhttps://github.com/neomjs/neo/issues/18948
authorneo-opus-vega
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 19, 2026, 6:11 PM

An unmatched ComboBox entry clears the value but not the text

neo-opus-vega
neo-opus-vega commented on Sep 19, 2026, 1:29 PM

Context

Found while driving examples/grid/cellEditing against the cell-editing contract the Grids guide states (#18866). The grid was the messenger, not the defect: the same behaviour reproduces in examples/form/field/combobox with no grid anywhere, so this is filed against form.field.ComboBox rather than as a leaf of #18762.

Measured 2026-09-19 on dev@7db03e862c, real Chromium, both reproductions driven through real input events.

The Problem

A ComboBox with forceSelection: true is supposed to refuse values that are not in its store. It does refuse them — but it refuses them silently and only half-way: the component's value becomes null while the input keeps displaying the text the user typed. The field then shows one thing and holds another, with nothing on screen saying so.

Reproduction A — standalone, no grid (examples/form/field/combobox, neo-combobox-1, forceSelection: true, displayField: 'name', valueField: 'abbreviation'):

step value (App Worker) displayed text error shown
initial the Arizona record Arizona —
type unmatched text — ArizonaZzzzz —
blur to another field null ArizonaZzzzz none

Reproduction B — the same field as a grid cell editor (examples/grid/cellEditing, country column, forceSelection: true, valueField: 'code', store bound through the state provider): type Zzzzz, then move focus out of the grid entirely. neo-countryfield-1.value is null, isDirty is true, the input still reads Zzzzz, and the record keeps its old country.

The control that scopes it. The partial-match branch is healthy. Typing Ariz and blurring resolves to the Arizona record and rewrites the displayed text to Arizona. So the typeahead coercion path works; only the no-match branch is broken. That control is what makes this a narrow fix rather than a rework of forceSelection.

What the grid adds. grid.plugin.CellEditing#completeEdit gates the write on editor.validate(false) (src/grid/plugin/CellEditing.mjs:119), so the invalid draft correctly keeps its editor and writes nothing — the guide's stated contract. But because ComboBox renders no error, the user is left with an editor that will not close, no explanation, the cell's real value hidden behind it, and focus already somewhere else. Compare form.field.Number in the same grid, which renders step-size violation: 7 / 5 into the cell and tells the user exactly what is wrong.

The Architectural Reality

src/form/field/ComboBox.mjs:633-648:

onFocusLeave(data) {
    let me = this;

    /*
     * If we are leaving the field, using forceSelection=true and the field does not have a selected record,
     * we do want to pick the closest match => the focussed record (honoring filters).
     * If no record is found, we will clear the field instead.
     */
    if (me.forceSelection && !me.value) {
        me.programmaticValueChange = true;
        me.value                   = me.listStore.get(me.activeRecordId);
        me.programmaticValueChange = false;
    }

    me.updateTypeAheadValue(null);

    super.onFocusLeave(data)
}

The comment states the intent in two branches. The first is implemented: a match is found and value is set, and the display follows from the value change. The second — "If no record is found, we will clear the field instead" — has no code. With no match, me.listStore.get(undefined) yields nothing, me.value is set to undefined, and updateTypeAheadValue(null) clears only the typeahead hint input. Nothing resets the real input's text, so it keeps the user's unmatched string.

The second architectural fact is that ComboBox declares no validation surface at all — no errorText*, no isValid(), no validate() override. form.field.Number has all three (src/form/field/Number.mjs:54, :280, :412), which is why it can say step-size violation: 7 / 5 and ComboBox can only fail silently. An unmatched entry under forceSelection is a validation outcome that the component currently has no vocabulary to express.

The Fix

  1. Give the no-match branch the behaviour its own comment claims. In ComboBox#onFocusLeave, when forceSelection is on and no record resolves, reset the displayed input text as well as the value, so display and value cannot disagree.
  2. Decide and implement what "clear" means — reverting to the last valid record and clearing to empty are both defensible, and they differ for a field that had a value before the user typed. The ticket prescribes that the two must agree, not which one wins; the implementer picks one and states it in the AC.
  3. Give the refusal a voice. Under forceSelection, an unmatched entry should be expressible as a validation error the way Number expresses a step violation, so a consumer that gates on validate() — grid.plugin.CellEditing#completeEdit is one — can show the user why nothing committed.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
ComboBox#forceSelection (public config, default true, src/form/field/ComboBox.mjs:85-87) the config's own JSDoc + onFocusLeave's comment at :633-640 an unmatched entry leaves display and value agreeing current behaviour = value null, text retained learn/guides/datahandling/Grids.md "Ending an Edit" describes the grid consequence measured both reproductions above
ComboBox#onFocusLeave (protected, :633) same implements the comment's second branch none today — source read at dev@7db03e862c
error vocabulary on ComboBox form.field.Number:54/:280/:412 as the in-repo precedent an unmatched forceSelection entry is expressible as an error silent refusal — grep shows zero errorText/isValid/validate in ComboBox.mjs

Decision Record impact

none — restores a documented intent inside one component; introduces no new primitive.

Acceptance Criteria

  • AC-1 A component arm drives a forceSelection ComboBox to unmatched text, blurs it, and asserts display and value agree. Red on dev today.
  • AC-2 The chosen "clear" semantic (revert-to-last-valid or clear-to-empty) is stated in the PR body and pinned by AC-1's assertion, so a later reader can tell a decision from an accident.
  • AC-3 A control arm preserves the healthy partial-match path: typing Ariz and blurring still resolves to Arizona in both value and text. This is the arm that proves the fix did not swallow the working branch.
  • AC-4 An unmatched forceSelection entry is expressible as a validation error, and an arm asserts a consumer gating on validate() can observe it.
  • AC-5 Mutation-proven: reverting the onFocusLeave change turns AC-1 red on its own.
  • AC-6 A grid arm on examples/grid/cellEditing asserts that an unmatched country entry which blocks its commit tells the user why, rather than leaving a silent editor. Covers the consequence that motivated the ticket.

Out of Scope

grid.plugin.CellEditing's commit gate, which is correct as written and already covered by #18863's merged arms — an invalid draft keeping its editor is the specified contract, not a defect. The typeahead hint mechanism. forceSelection's default. Any change to how getSubmitValue() maps a record to valueField.

Avoided Traps

  • Do not "fix" this in the grid. The standalone reproduction has no grid in it; a grid-side workaround would leave every other forceSelection consumer broken and add a second owner for one behaviour.
  • Do not assume the whole forceSelection blur path is broken. The partial-match control passes; a rework that does not keep AC-3 green would regress behaviour that #7708 deliberately fixed.
  • Do not reopen #5214. It is CLOSED as NOT_PLANNED (2024-09-12) against the superseded form.field.Select, and its code excerpt does not match today's ComboBox. It is cited below as stated intent, not as live scope.

Related

  • #5214 — CLOSED/NOT_PLANNED, 2024, form.field.Select. States the intent this ticket restores: "if the widget is using the forceSelection config, non matching values need to get cleared." Different class, never actioned.
  • #7708 — CLOSED/COMPLETED 2025-11-06, fix(ComboBox): Correct forceSelection behavior. Fixed the match branch; AC-3 exists to keep it fixed.
  • #18762 — the grid cell-editing epic whose testing surfaced this. Deliberately not filed as a sub: the defect is in the form layer.
  • #18866 / #18935 — the Grids guide section used as the oracle.

Sweeps and ownership

  • Live latest-open sweep: latest 20 open issues read at 2026-09-19T11:25Z; no equivalent. Also swept state:all for forceSelection and for ComboBox blur/value — hits are #5214 and #7708, both disposed above.
  • A2A in-flight claim sweep: list_messages({status:'all', limit:30}) at 11:25Z covering the 10:30–11:25Z herd window. Live claims are #18941/#18943 (@neo-fable), #18942 (@neo-opus-ada), #18944/#18947 (@neo-opus-grace), #18945/#18946 (@neo-fable), Institution #170/#171 (@neo-fable-clio). None touches form.field.ComboBox. @neo-fable answered my [lane-intent] on this example directly and moved off it.
  • Memory Core rationale sweep: keyed on the observed symptom. Surfaced the 2025-11-06 #7708 session, where the same class of symptom (Expected "Marshall Islands", Received "Mar") was traced to onFocusLeave and updateTypeAheadValue clearing activeRecordId. That session fixed the match branch; the no-match branch measured today is what it left behind.
  • Own-assignment sweep: my open assigned tickets are #18532, #17918, #16358, #16212, #15202 and five in neo-agent-brain; none is form- or ComboBox-adjacent.
  • unowned-rationale: filed unowned and claimable. I found it while exploratory-testing the grid epic and my named lane is there; this wants an owner who can settle the revert-vs-clear semantic (AC-2), which is a product call more than a mechanical one.

Handoff Retrieval Hints

Retrieval Hint: "ComboBox forceSelection no-match blur value null text retained" · source anchors src/form/field/ComboBox.mjs:633-648, src/form/field/Number.mjs:54/:280/:412, src/grid/plugin/CellEditing.mjs:119 · measured at dev@7db03e862c.

tobiu referenced in commit 284162d - "fix(form): a forceSelection ComboBox refuses text that matches no record, and returns to the record it held (#18948) (#18949) on Sep 19, 2026, 6:11 PM
tobiu closed this issue on Sep 19, 2026, 6:11 PM