Skip to content

fix(material/sort): programatically setting sort-header active/direction does not update UI #22092

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/material/sort/sort-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ export class MatSortHeader extends _MatSortHeaderMixinBase
.subscribe(() => {
if (this._isSorted()) {
this._updateArrowDirection();
// If this header wasn't recently active and now becomes sorted, animate the arrow in.
if (this._viewState && this._viewState.fromState !== 'active'
&& this._viewState.toState !== 'active') {
this._disableViewStateAnimation = false;
this._setAnimationTransitionState(
{fromState: this._arrowDirection, toState: 'active'});
}
}

// If this header was recently active and now no longer sorted, animate away the arrow.
Expand Down