Skip to content

Commit

Permalink
fix(material/sort): clear aria description on destroy
Browse files Browse the repository at this point in the history
Fixes that the sort header wasn't clearing its ARIA description when it gets destroyed, causing a memory leak.
  • Loading branch information
crisbeto committed Mar 31, 2024
1 parent 46db6a6 commit 8a8b958
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/material/sort/sort-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ export class MatSortHeader implements MatSortable, OnDestroy, OnInit, AfterViewI
this._focusMonitor.stopMonitoring(this._elementRef);
this._sort.deregister(this);
this._rerenderSubscription.unsubscribe();

if (this._sortButton) {
this._ariaDescriber?.removeDescription(this._sortButton, this._sortActionDescription);
}
}

/**
Expand Down

0 comments on commit 8a8b958

Please sign in to comment.