Skip to content

fr(MatStepper): No notification mechanism on step interacted without a step change. #19918

Closed

Description

@paulferaud

Reproduction

  • Given a linear stepper, with steps associated to forms.
  • Have step 1 with an invalid state (which would prevent navigating to step 2)
  • Click on header 2.

Expected Behavior

A SelectionChange event to be fired, saying step 1 was selected (from step 1 before, yes)

Actual Behavior

Nothing happened

Why

By clicking on the next step, but being denied, then the step is marked as “interacted”, which causes the formFields’s errorStateMatcher start emitting true, making field “red”. This is nice user experience.

HOWEVER, my Steps are actually implemented by components, and they have ChangeDetectionStrategy.OnPush. The issue I have is I have NO WAY to notify my component of the event, and tell it to refresh it’s form’s states.

Might be related to #18080

Environment

  • Angular: 10.0.1

Activity

  1. added
    needs triage
    on Jul 9, 2020
  2. added
    needs: clarification
    G
    and removed
    needs triage
    on Jul 9, 2020
  3. jelbourn commented on Jul 9, 2020

    @jelbourn
    Contributor

    @paulferaud would you be able to create a reproduction in StackBlitz that demonstrates the issue?

  4. paulferaud commented on Jul 10, 2020

    @paulferaud
    ContributorAuthor

    Sure. Here: https://stackblitz.com/edit/angular-adnhub

    I’m not entirely sure what the “expected” behavior needs to be. The issue is my nested component has no way of being notified of the change:

    (Sorry about internal videos. Not sure how else to easily share)

    Would there be any easy to make MatStepper’s next() method somehow submit the form that is configured on that MatStep?

    The alternative might also be to also monitor selectionChange events, eg:

    merge(formGroupDirective.ngSubmit, matStepper.selectionChange).subscribe(() => cd.detectChanges);
    

    But that breaks down because in this case, since no event is actually fired. Essentially nothing is fired.

  5. added
    feature
    P3
    and removed
    needs: clarification
    on Jul 10, 2020
  6. changed the title [-]bug(MatStepper): No notification mechanism on step `interacted` without a step change.[/-] [+]fr(MatStepper): No notification mechanism on step `interacted` without a step change.[/+] on Jul 10, 2020
  7. self-assigned this
    on Apr 5, 2021
  8. added 5 commits that reference this issue on Apr 5, 2021
    fc7aee7
    28052a7
    5588975
    9710d3f
    3611b0f
  9. added a commit that references this issue on Apr 13, 2021
    9b4c503
  10. angular-automatic-lock-bot commented on May 14, 2021

    @angular-automatic-lock-bot

    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.

  11. locked and limited conversation to collaborators on May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GP3area: cdk/stepperfeature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions