-
Notifications
You must be signed in to change notification settings - Fork 762
[NG] Adding aria-label to clr-dg-column button. #3384
Conversation
Adding accessability aria-label to clr-dg-column when sorting is enabled Adding key sorfOf into CommonString Updating i18n documentation fixes: vmware-archive#1930 Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we talked offline, the proposed label format of "Sort on " is problematic, because:
- We have no control what the user will put there and if it will be readable at all.
- The column name was already read just a second before announcing it's a button.
- There are (minor) technical difficulties that require us to work directly with the DOM in implementation specific way, which is undesirable.
Because of the above, the current implementation that does not read the column name again, looks good to me.
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Update Copyright Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
I think there is probably a second piece to this, where we look at how to use |
The aria-sort is already in place, but it is responsible for announcing things like: "This column has been sorted in ascending order". From the spec you referenced:
It is not responsible for announcing what the button in the header does. It has to be applied to grid or table headers only, it has no notion of the possible buttons inside. |
Ok, got confused in my review, aria-sort is there. |
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
The material solution for this type of issues is something like that: // https://github.com/angular/components/blob/9eeb4b5aa0473c0815a73bfe3c2ed6164d86a3b3/src/material/sort/sort-header-intl.ts
/** ARIA label for the sorting button. */
sortButtonLabel = (id: string) => {
return `Change sorting for ${id}`;
}
}
// https://github.com/angular/components/blob/9eeb4b5aa0473c0815a73bfe3c2ed6164d86a3b3/src/material/sort/sort-header.html
<button class="mat-sort-header-button" type="button"
[attr.disabled]="_isDisabled() || null"
[attr.aria-label]="_intl.sortButtonLabel(id)"
(focus)="_setIndicatorHintVisible(true)"
(blur)="_setIndicatorHintVisible(false)">
<ng-content></ng-content>
</button> Which is a nice and simple solution, the tricky part is that they have already the name of the column. <th mat-sort-header="name">Dessert</th>
<th mat-sort-header="calories">Calories</th> I have hard times getting the content from the table column:
On the other topic, The best solution will be to be able to create a string that will say If someone has some clever idea, don't be shy? |
…nto issue_1930
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Deploy preview for vmware-clarity ready! Built with commit 81d9c98 |
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few tweaks otherwise pre-approving so you can merge with those changes. Also we need to backport this to v1
branch.
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
Adding accessibility
aria-label
toclr-dg-column
when sorting is enabledAdding key
sorfOf
into CommonStringUpdating i18n documentation
fixes: #1930