Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/stepper): incorrect navigation order when steps are added later on #23541

Merged
merged 1 commit into from Sep 10, 2021

Commits on Sep 7, 2021

  1. fix(material/stepper): incorrect navigation order when steps are adde…

    …d later on
    
    The Material stepper's template is set up such that we have a single `ng-template` at the bottom declaring the header which is then rendered out with an `ngTemplateOutlet` inside an `ngFor`. We do this in order to reduce duplication, because a lot of properties and attributes have to be set on `mat-step-header`.
    
    Then problem with this approach is that because the header is outside the `ngFor`, it may not appear in the correct order in the `ngFor` if the list changes. This results in incorrect navigation order when using the next/previous buttons or the keyboard.
    
    These changes add some logic that will sort the headers based on their position in the DOM in order to work around the issue. Alternatively, we could fix this by inlining the `mat-step-header` template, but that'll result in some duplicated code that is somewhat error-prone if we ever need to add more attributes.
    
    Fixes angular#23539.
    crisbeto committed Sep 7, 2021
    Copy the full SHA
    923b41d View commit details
    Browse the repository at this point in the history