Skip to content

refactor(material/sort): inject AriaDescriber as required - #33899

Closed
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:refactor/sort-header-required-aria-describer
Closed

MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:refactor/sort-header-required-aria-describer

Conversation

@MeAkib

@MeAkib MeAkib commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

MatSortHeader was injecting AriaDescriber as optional and guarding every call with optional chaining. AriaDescriber is always available since it's automatically provided, and MatTooltip and MatBadge already inject it as required, so we can drop the optional flag and the null checks.

`MatSortHeader` was injecting `AriaDescriber` as optional and guarding every call with optional chaining. `AriaDescriber` is always available since it's automatically provided, and `MatTooltip` and `MatBadge` already inject it as required, so we can drop the optional flag and the null checks.
private _changeDetectorRef = inject(ChangeDetectorRef);
private _focusMonitor = inject(FocusMonitor);
private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
private _ariaDescriber = inject(AriaDescriber, {optional: true});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a reason we didn't do this during the inject migration was that some apps were stubbing this out somehow in tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the context, that makes sense. I'll close this.

@MeAkib MeAkib closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants