Skip to content

bug(mat-bottom-sheet): custom form validation is executed multiple times #49959

@ibrahimgabsi

Description

@ibrahimgabsi

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

13.3.9

Description

For one single change inside a form with custom validation, the validate() method is triggered multiple times.
The parameter is, first time, the form control where the change is applied, then the parent form group, and finaly the abstracted control.
This behavior occurs only within a form inside mat-bottom-sheet and starting from the version 14.x.x.

Reproduction

Steps to reproduce:

  1. (Please c.f. Stackblitz to reproduce the issue!! )
  2. Type something in the Phone number field and check that one log is outputed with the abstracted control
  3. Now, click Open bottom sheet and type something else. Note that multiple messages are outputed in the console for one single change

Expected Behavior

Expect validate() method to be executed one single time when a a single change is typed inside a mat-bottom-sheet.

Actual Behavior

validate() method is triggered multiple times.

Environment

  • Angular: 15.1.5
  • CDK/Material: <= 14.0.0
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions