mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[ADF-2990] Datatable - access header row via keyboard (#5206)
* header row as adf-datatable-row * remove tabindex if header is hidden * adjust logic if no row data is passed * skip row focus if disabled * set active row index on header interaction * take in account header row * fix header row and cells focus * tests * fix reference * fix tests
This commit is contained in:
committed by
Eugenio Romano
parent
5c4511e42b
commit
040fc52724
@@ -223,7 +223,9 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.keyManager = new FocusKeyManager(this.rowsList).withWrap();
|
||||
this.keyManager = new FocusKeyManager(this.rowsList)
|
||||
.withWrap()
|
||||
.skipPredicate(item => item.disabled);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
@@ -406,7 +408,9 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
}
|
||||
|
||||
if (row) {
|
||||
this.keyManager.setActiveItem(this.data.getRows().indexOf(row));
|
||||
const rowIndex = this.data.getRows().indexOf(row) + (this.isHeaderVisible() ? 1 : 0);
|
||||
this.keyManager.setActiveItem(rowIndex);
|
||||
|
||||
const dataRowEvent = new DataRowEvent(row, mouseEvent, this);
|
||||
this.clickObserver.next(dataRowEvent);
|
||||
}
|
||||
@@ -511,6 +515,8 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
this.data.setSorting(new DataSorting(column.key, newDirection));
|
||||
this.emitSortingChangedEvent(column.key, newDirection);
|
||||
}
|
||||
|
||||
this.keyManager.updateActiveItemIndex(0);
|
||||
}
|
||||
|
||||
onSelectAllClick(matCheckboxChange: MatCheckboxChange) {
|
||||
|
Reference in New Issue
Block a user