Skip to content

feat(MatChipGrid): Update form component value on chip removal #30566

Open
@eolant

Description

@eolant

Feature Description

In existing example from the docs for MatChip with Reactive form (https://material.angular.io/components/chips/overview#chips-reactive-form) the changes to the form component are not pushed until you de-focus the input field i.e see in this example https://stackblitz.com/edit/vfwahhih?file=src%2Fexample%2Fchips-reactive-form-example.ts output of Values being updated only when you deselect the input.

Ideally it would be great if there was a method to trigger form control value update whenever chips gets deleted because atm when you inputting chips and deleting them, you not losing focus from the input field and you'll need to click out of the field to see changes.

Use Case

For example I have another dropdown field which prompts user to select a movie of the ones he listed in the chips field. If user decides to delete the movie from chips I want to react to this change immediatly for a better UX and clear the following field with selected value.

This is the most basic scenario but they can be way more complicated and with bigger forms, conditional fields and required field groups and with dynamic form fields and field types which requires to abstract away from the chips handling itself and use field value as a source of thruth itself.

This is what my workaround looks like atm which is quite ugly and it would be a lot nicer if it was handled by Angular Material internally or at least there was a separate method to call and sync chips to form control value.

this.isFocusTransitioning.set(true);
this.matInput()?.focus();
(this.document.activeElement as HTMLElement).blur();
setTimeout(() => {
  this.matInput()?.focus();
  this.isFocusTransitioning.set(false);
});

Activity

added
featureThis issue represents a new feature or feature request rather than a bug or bug fix
needs triageThis issue needs to be triaged by the team
on Feb 28, 2025
added
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
and removed
featureThis issue represents a new feature or feature request rather than a bug or bug fix
needs triageThis issue needs to be triaged by the team
on Mar 11, 2025
mistrykaran91

mistrykaran91 commented on Jun 24, 2025

@mistrykaran91
Contributor

Hi! Is anybody working on it? Otherwise, I could try to fix it if you don't mind.

added a commit that references this issue on Jun 24, 2025
8181759
added 2 commits that reference this issue on Jun 24, 2025
3927001
2fd3421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/chips

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @eolant@crisbeto@mistrykaran91

      Issue actions

        feat(MatChipGrid): Update form component value on chip removal · Issue #30566 · angular/components