Skip to content

refactor(forms): make markAsTouched() touch all descendants by default - #67453

Merged
mattrbeck merged 1 commit into
angular:mainfrom
leonsenft:sf-mark-all-as-touched
Mar 16, 2026
Merged

mattrbeck merged 1 commit into
angular:mainfrom
leonsenft:sf-mark-all-as-touched

Conversation

@leonsenft

@leonsenft leonsenft commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

markAsTouched() now marks all descendants as touched. In general this method is called when controls update the model. Most controls update leaf nodes, in which case this change has no effect.

Marking all descendants allows triggering validation for subsections of a form, independently from having to call submit() on the entire form.

markAsTouched() now accepts a MarkAsTouchedOptions parameter, which includes a skipDescendants property. This can be used mark only the receiving field as touched: node.markAsTouched({skipDescendants: true}).

@leonsenft
leonsenft requested a review from kirjs March 5, 2026 00:57
@leonsenft leonsenft added area: forms target: patch This PR is targeted for the next patch release forms: signals labels Mar 5, 2026
@ngbot ngbot Bot modified the milestone: Backlog Mar 5, 2026
@pullapprove
pullapprove Bot requested a review from crisbeto March 5, 2026 00:57
Comment thread packages/forms/signals/src/api/types.ts Resolved
@leonsenft
leonsenft requested review from JeanMeche and removed request for crisbeto March 9, 2026 20:25
Comment thread packages/forms/signals/src/api/types.ts Resolved
@pullapprove
pullapprove Bot requested a review from crisbeto March 9, 2026 23:49

@JeanMeche JeanMeche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed-for: public-api

@JeanMeche
JeanMeche removed request for crisbeto and kirjs March 10, 2026 14:54
@JeanMeche JeanMeche added the action: merge The PR is ready for merge by the caretaker label Mar 10, 2026
@ngbot

ngbot Bot commented Mar 10, 2026

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@JeanMeche JeanMeche added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 10, 2026
@JeanMeche

Copy link
Copy Markdown
Member

Presubmit failures are unrelated, this is good to go

@atscott
atscott force-pushed the sf-mark-all-as-touched branch from df8423f to 5c1c201 Compare March 11, 2026 17:42
@atscott atscott added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Mar 11, 2026
`markAsTouched()` now marks all descendants as touched. In general this
method is called when controls update the model. Most controls update
leaf nodes, in which case this change has no effect.

Marking all descendants allows triggering validation for subsections of
a form, independently from having to call `submit()` on the entire form.

`markAsTouched()` now accepts a `MarkAsTouchedOptions` parameter, which
includes a `skipDescendants` property. This can be used mark only the
receiving field as touched: `node.markAsTouched({skipDescendants: true})`.
@leonsenft
leonsenft force-pushed the sf-mark-all-as-touched branch from 5c1c201 to 8f9f65c Compare March 11, 2026 18:06
@angular-robot
angular-robot Bot requested a review from JeanMeche March 11, 2026 18:06
@leonsenft leonsenft added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Mar 11, 2026
@leonsenft

Copy link
Copy Markdown
Contributor Author

Note for caretaker: ready for merge again

@leonsenft leonsenft added the action: merge The PR is ready for merge by the caretaker label Mar 16, 2026
@mattrbeck

Copy link
Copy Markdown
Member

This PR has some conflicts with 21.2.x

@leonsenft leonsenft added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Mar 16, 2026
@mattrbeck
mattrbeck merged commit eeba51c into angular:main Mar 16, 2026
23 of 25 checks passed
@mattrbeck

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@leonsenft
leonsenft deleted the sf-mark-all-as-touched branch March 17, 2026 18:10
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: forms forms: signals merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants