angular / angular/components

Setting a single formControl to Untouched does not reset the error css state

Open
#14,289 8 comments 1 reaction 0 assignees View on GitHub
area: material/form-field P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Bug, feature request, or proposal:
Bug

#### What is the expected behavior?
Don't use mat-form-field-invalid, but use the native angular core css classes ng-invalid
Because mat-form-field-invalid does not get removed when setting a single formControl to untouched

#### What is the current behavior?
mat-form-field-invalid does not get removed when doing markAsUntouched

#### What are the steps to reproduce?
Providing a StackBlitz reproduction is the *best* way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

On every simple form

#### What is the use-case or motivation for changing an existing behavior?
Material uses it's own mat-form-field-invalid css class instead of the angular core css classes, this makes error. This is a wrong design

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
newest versions

#### Is there anything else we should know?

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and trace how markAsUntouched affects the Material form-field error state versus Angular's native form-control classes. Confirm the behavior on a simple form, then verify that marking one control untouched removes the corresponding invalid styling without changing other controls.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.