From 1a498a6a811dfd081becbc330c984b23a23de5e6 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 24 Feb 2022 17:06:53 +0100 Subject: [PATCH] fix(material/sort): remove role from header when disabled (#24477) When the sort header is disabled, we make it non-interactive by clearing its `tabindex`, however it still has the `role="button"` which can throw off screen readers if it doesn't have text. These changes also clear the `role` from the header if it's disabled. (cherry picked from commit 229dd6e1748991b014d4e41005be2a74dda7167e) --- src/material/sort/sort-header.html | 2 +- src/material/sort/sort-header.ts | 2 +- src/material/sort/sort.spec.ts | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/material/sort/sort-header.html b/src/material/sort/sort-header.html index cc575585a601..db76622dd754 100644 --- a/src/material/sort/sort-header.html +++ b/src/material/sort/sort-header.html @@ -12,7 +12,7 @@ [class.mat-sort-header-sorted]="_isSorted()" [class.mat-sort-header-position-before]="arrowPosition == 'before'" [attr.tabindex]="_isDisabled() ? null : 0" - role="button"> + [attr.role]="_isDisabled() ? null : 'button'">