Context
Two sightings in apps/form, which opts into useAlertState. The first was while measuring #21516's AC-1: "a half-typed required email shows the alert color", noted as pre-existing in defect-note 78df7b44. The second, on Fri 20 Nov on dev 5cb81df00a, came with the mechanism (defect-note 702523f3). Headless Chromium, neo-dark, the required "Work email" field, then Tab:
| Input |
Field classes afterwards |
.neo-textfield-error color |
fill('jane.doe@'): one input event, as a paste or an autofill sends |
neo-empty-required, neo-has-content, neo-invalid |
rgb(255, 171, 64), the alert color |
pressSequentially('jane.doe@'): one event per character |
neo-has-content, neo-invalid |
rgb(255, 138, 128), the invalid color |
A pasted valid email keeps neo-empty-required too, but nothing shows it, because the alert rules nest under .neo-invalid.
The Problem
A field the user has just filled is styled as "required and still empty". Its error renders in the alert color instead of the invalid color, for anyone who pastes or autofills, which is how most emails get into a form. The class corrects itself only on the next input event, so typing hides the defect and paste exposes it.
The Architectural Reality
src/form/field/Text.mjs#afterSetInputValue toggles neo-empty-required from me.isEmpty() (:559). isEmpty() (:1435) reads value, and value is written at the end of the same method, by me.updateValueFromInputValue(value) (:565). The toggle therefore sees the value from before this input.
afterSetValue (:971) runs after every value change and already toggles neo-is-dirty there (:986), but not neo-empty-required. Nothing else toggles it: grep -n empty-required src/form/field finds only :559.
- When the user types, each input event fixes the class the previous one left behind. One event (a paste, an autofill or
fill()) leaves it wrong.
resources/css/src/form/field/Text.css nests &.neo-empty-required (:139) inside &.neo-invalid:not(.neo-disabled) (:114), and paints its .neo-textfield-error with --textfield-border-color-alert.
Design authority: useAlertState's JSDoc (Text.mjs:281): "Using the alert state will display an empty but required field in orange instead of red." A field with content in it is not empty.
The Fix
Toggle neo-empty-required in afterSetValue, beside neo-is-dirty, where isEmpty() reads the value it describes. Remove the toggle from afterSetInputValue. Every value change, typed or programmatic, then updates the class once, from the current value.
Acceptance Criteria
Out of Scope
- Changing
required or useAlertState at runtime. The class follows at the next value change, as it does today.
- The alert and invalid colors themselves (#21516).
- PrefixField's reordered keystrokes (#21555).
Avoided Traps
- Calling
updateValueFromInputValue earlier in afterSetInputValue. That would run afterSetValue, and with it the change event, before afterSetInputValue has updated neo-has-content. Moving the toggle keeps one owner for value-derived classes.
Related
Parent #21329 (Forms & Fields at the Engine 14 cut) · #21516 / #21514 (neo-dark colors, whose AC-1 first saw this) · apps/form (#21336)
Ownership: Ada, for the Engine 14 lock on Sun 22 Nov under #21329, so not curated for contributors.
Live latest-open + closed sweep: the latest 20 open, plus open and closed searches ("required field alert state empty", "useAlertState OR neo-empty-required OR alert state required field"), at 2026-11-20T13:44Z and again at 13:49Z. No equivalent or prior exclusion. Backlog band: 53 open (red). This folds under the owning epic #21329. A2A: no claim on this scope among the latest 15, all read states. MC sweep: one symptom query ("required field shows the orange alert color instead of the red error after typing or pasting text"), 5 results, no prior decision. Own-assignment sweep: 4 open (#21559, #21329, #21049, #21041), none on this surface.
Origin Session ID: 523871d7-f228-44fc-bef7-f7720de4e0cd
Retrieval Hint: "required field neo-empty-required alert state lags one input event after paste or autofill, useAlertState"
⚖️ Ada · @neo-opus-ada · Claude Opus 5.5 · Claude Code
Context
Two sightings in
apps/form, which opts intouseAlertState. The first was while measuring #21516's AC-1: "a half-typed required email shows the alert color", noted as pre-existing in defect-note78df7b44. The second, on Fri 20 Nov ondev5cb81df00a, came with the mechanism (defect-note702523f3). Headless Chromium, neo-dark, the required "Work email" field, then Tab:.neo-textfield-errorcolorfill('jane.doe@'): one input event, as a paste or an autofill sendsneo-empty-required,neo-has-content,neo-invalidrgb(255, 171, 64), the alert colorpressSequentially('jane.doe@'): one event per characterneo-has-content,neo-invalidrgb(255, 138, 128), the invalid colorA pasted valid email keeps
neo-empty-requiredtoo, but nothing shows it, because the alert rules nest under.neo-invalid.The Problem
A field the user has just filled is styled as "required and still empty". Its error renders in the alert color instead of the invalid color, for anyone who pastes or autofills, which is how most emails get into a form. The class corrects itself only on the next input event, so typing hides the defect and paste exposes it.
The Architectural Reality
src/form/field/Text.mjs#afterSetInputValuetogglesneo-empty-requiredfromme.isEmpty()(:559).isEmpty()(:1435) readsvalue, andvalueis written at the end of the same method, byme.updateValueFromInputValue(value)(:565). The toggle therefore sees the value from before this input.afterSetValue(:971) runs after every value change and already togglesneo-is-dirtythere (:986), but notneo-empty-required. Nothing else toggles it:grep -n empty-required src/form/fieldfinds only:559.fill()) leaves it wrong.resources/css/src/form/field/Text.cssnests&.neo-empty-required(:139) inside&.neo-invalid:not(.neo-disabled)(:114), and paints its.neo-textfield-errorwith--textfield-border-color-alert.Design authority:
useAlertState's JSDoc (Text.mjs:281): "Using the alert state will display an empty but required field in orange instead of red." A field with content in it is not empty.The Fix
Toggle
neo-empty-requiredinafterSetValue, besideneo-is-dirty, whereisEmpty()reads the value it describes. Remove the toggle fromafterSetInputValue. Every value change, typed or programmatic, then updates the class once, from the current value.Acceptance Criteria
useAlertState: true) leaves noneo-empty-requiredin itscls. One more event that clears it sets the class again. Covered by a unit spec that is red ondevand green at head.apps/form,fill('jane.doe@')in Work email and then Tab: the error text computes to the invalid color, not the alert color (outside-CI receipt on the PR, red ondev).test/playwright/unit/form/field/) andtest/playwright/e2e/form/FormApp.spec.mjsstay green.Out of Scope
requiredoruseAlertStateat runtime. The class follows at the next value change, as it does today.Avoided Traps
updateValueFromInputValueearlier inafterSetInputValue. That would runafterSetValue, and with it the change event, beforeafterSetInputValuehas updatedneo-has-content. Moving the toggle keeps one owner for value-derived classes.Related
Parent #21329 (Forms & Fields at the Engine 14 cut) · #21516 / #21514 (neo-dark colors, whose AC-1 first saw this) ·
apps/form(#21336)Ownership: Ada, for the Engine 14 lock on Sun 22 Nov under #21329, so not curated for contributors.
Live latest-open + closed sweep: the latest 20 open, plus open and closed searches ("required field alert state empty", "useAlertState OR neo-empty-required OR alert state required field"), at 2026-11-20T13:44Z and again at 13:49Z. No equivalent or prior exclusion. Backlog band: 53 open (red). This folds under the owning epic #21329. A2A: no claim on this scope among the latest 15, all read states. MC sweep: one symptom query ("required field shows the orange alert color instead of the red error after typing or pasting text"), 5 results, no prior decision. Own-assignment sweep: 4 open (#21559, #21329, #21049, #21041), none on this surface.
Origin Session ID: 523871d7-f228-44fc-bef7-f7720de4e0cd
Retrieval Hint: "required field neo-empty-required alert state lags one input event after paste or autofill, useAlertState"
⚖️ Ada ·
@neo-opus-ada· Claude Opus 5.5 · Claude Code