Skip to content

Commit

Permalink
fix(material/sort): clear aria description on destroy (#28801)
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.

(cherry picked from commit ced93a9)
  • Loading branch information
crisbeto committed Apr 2, 2024
1 parent 6b5b0c5 commit 8b92fda
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 8b92fda

Please sign in to comment.