mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-2567] - sortable (#5402)
* chore: aca-2567 accessibility for sortable columns * chore: sortable table accessibility update * fix: refactor sortable table headers into function * chore: updated sort by text Co-authored-by: Mark Steadman <47225088+Steady5063@users.noreply.github.com>
This commit is contained in:
@@ -31,10 +31,9 @@
|
||||
role="columnheader"
|
||||
[attr.tabindex]="showHeader ? 0 : null"
|
||||
[attr.aria-sort]="col.sortable ? (getAriaSort(col) | translate) : null"
|
||||
title="{{ col.title | translate }}"
|
||||
adf-drop-zone dropTarget="header" [dropColumn]="col">
|
||||
<span *ngIf="col.srTitle" class="adf-sr-only">{{ col.srTitle | translate }}</span>
|
||||
<span *ngIf="col.title" class="adf-datatable-cell-value">{{ col.title | translate}}</span>
|
||||
<span class="adf-sr-only" aria-live="polite">{{ getSortLiveAnnouncement(col) | translate: {string: col.title} }}</span>
|
||||
</div>
|
||||
<!-- Actions (right) -->
|
||||
<div *ngIf="actions && actionsPosition === 'right'" class="adf-actions-column adf-datatable-cell-header adf-datatable__actions-cell">
|
||||
|
@@ -763,6 +763,15 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
'ADF-DATATABLE.ACCESSIBILITY.SORT_ASCENDING' :
|
||||
'ADF-DATATABLE.ACCESSIBILITY.SORT_DESCENDING';
|
||||
}
|
||||
|
||||
getSortLiveAnnouncement(column: DataColumn): string {
|
||||
if (!this.isColumnSortActive(column)) {
|
||||
return 'ADF-DATATABLE.ACCESSIBILITY.SORT_DEFAULT' ;
|
||||
}
|
||||
return this.isColumnSorted(column, 'asc') ?
|
||||
'ADF-DATATABLE.ACCESSIBILITY.SORT_ASCENDING_BY' :
|
||||
'ADF-DATATABLE.ACCESSIBILITY.SORT_DESCENDING_BY';
|
||||
}
|
||||
}
|
||||
|
||||
export interface DataTableDropEvent {
|
||||
|
Reference in New Issue
Block a user