From 65a1564ec9abdd8734268c8f870e218c38a597ad Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 24 Feb 2022 14:19:18 +0100 Subject: [PATCH] fix(material/sort): remove role from header when disabled 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. --- 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 6d6067dfe085..77af0a462235 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'">