Files
angular/packages/forms
Shuaib Hasan Akib 5b66fb4010 fix(forms): flush debounced descendant values when a field is touched
`markAsTouched()` synchronized a pending debounced value only on the
field it was called on. Its descendants were marked as touched, but
their pending values stayed unsynced.

`submit()` marks the root as touched before running the action, so
submitting with Enter while a debounced child still had focus ran the
action with the child's old value. Clicking a submit button hid the bug,
because the click blurs the input first.

This is a regression from #67453. Before it, `submit()` called the
public `markAsTouched()` on each active field, which flushed it.

Flush each field's pending value right after marking it as touched.
Disabled, hidden and readonly fields still aren't marked as touched, but
unlike before #67453 they are flushed too, so their pending value reaches
the model before the action reads it. Below them only fields that already
exist are visited, since a field that was never created can't have a
pending value.

Tested with new specs in `//packages/forms/signals/test/node:test`. The
specs for descendants, `submit()`, an invalid flushed value, a duration
debounce and sibling fields fail without the fix; another checks that
touching a form doesn't create the fields of a hidden subtree.

Fixes #71149

(cherry picked from commit cf37344a4d)
2026-11-11 22:13:36 +00:00
..