Skip to content

Commit 9024eb4

Browse files
committed
Merge branch 'ddincheva/focuslessKBNav' of https://github.com/IgniteUI/igniteui-angular into ddincheva/focuslessKBNav
2 parents babe451 + 6e59faf commit 9024eb4

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

projects/igniteui-angular/src/lib/grids/grid-mrl-navigation.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ export class IgxGridMRLNavigationService extends IgxGridNavigationService {
211211

212212
headerNavigation(event: KeyboardEvent) {
213213
const key = event.key.toLowerCase();
214+
if (!this.activeNode.layout) {
215+
this.activeNode.layout = this.layout(this.activeNode.column || 0);
216+
}
214217
if (key.includes('down') || key.includes('up')) {
215218
event.preventDefault();
216219
const children = this.parentByChildIndex(this.activeNode.column).children;

projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,15 @@ export class IgxGridNavigationService {
201201
focusTbody(event) {
202202
this.activeNode = !this.activeNode ? { row: 0, column: 0 } : this.activeNode;
203203
if (!this.activeNode || !(this.activeNode.row < 0 || this.activeNode.row > this.grid.dataView.length - 1)) { return; }
204-
this.navigateInBody(0, 0, (obj) => { obj.target.activate(event); });
204+
this.navigateInBody(0, 0, (obj) => {
205+
this.grid.clearCellSelection();
206+
obj.target.activate(event);
207+
});
205208
}
206209

207210
focusFirstCell(header = true) {
208211
if (this.activeNode && (this.activeNode.row === -1 || this.activeNode.row === this.grid.dataView.length)) { return; }
209-
this.activeNode = { row: header ? -1 : this.grid.dataView.length, column: 0 };
212+
this.activeNode = { row: header ? -1 : this.grid.dataView.length, column: 0, level: 0 };
210213
this.performHorizontalScrollToCell(0);
211214
}
212215

projects/igniteui-angular/src/lib/grids/headers/grid-header-group.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
[attr.aria-label]="column.header || column.field"
4141
[attr.aria-expanded]="column.expanded"
4242
[attr.aria-selected]="column.selected"
43-
tabindex="0"
4443
[ngClass]="{
4544
'igx-grid__th--pinned-last': hasLastPinnedChildColumn,
4645
'igx-grid__th--pinned-first': hasFirstPinnedChildColumn,
@@ -51,6 +50,7 @@
5150
[ghostHost]="grid.outletDirective.nativeElement"
5251
[attr.droppable]="true"
5352
[igxColumnMovingDrop]="column"
53+
(pointerdown)="activate()"
5454
(click)="groupClicked($event)"
5555
(pointerenter)="onPinterEnter()"
5656
(pointerleave)="onPointerLeave()"
@@ -80,7 +80,7 @@
8080

8181
<ng-container *ngIf="!column.columnGroup">
8282
<span *ngIf="grid.hasMovableColumns" class="igx-grid__th-drop-indicator-left"></span>
83-
<igx-grid-header [igxColumnMovingDrag]="column" [ghostHost]="grid.outletDirective.nativeElement" [attr.droppable]="true" [igxColumnMovingDrop]="column" [gridID]="column.grid.id" [column]="column"></igx-grid-header>
83+
<igx-grid-header [igxColumnMovingDrag]="column" [ghostHost]="grid.outletDirective.nativeElement" [attr.droppable]="true" (pointerdown)="activate()" [igxColumnMovingDrop]="column" [gridID]="column.grid.id" [column]="column"></igx-grid-header>
8484
<igx-grid-filtering-cell *ngIf="grid.allowFiltering && grid.filterMode == 'quickFilter'" [column]="column" [attr.draggable]="false"></igx-grid-filtering-cell>
8585
<span *ngIf="!column.columnGroup && column.resizable" class="igx-grid__th-resize-handle"
8686
[igxResizeHandle]="column"

projects/igniteui-angular/src/lib/grids/headers/grid-header-group.component.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,15 @@ export class IgxGridHeaderGroupComponent implements DoCheck {
298298
@HostListener('pointerdown', ['$event'])
299299
public pointerdown(event): void {
300300
event.stopPropagation();
301-
this.grid.navigation.activeNode = {row: -1, column: this.column.visibleIndex, level: this.column.level,
302-
mchCache: {level: this.column.level, visibleIndex: this.column.visibleIndex},
303-
layout: this.column.columnLayoutChild ? {
304-
rowStart: this.column.rowStart,
305-
colStart: this.column.colStart,
306-
rowEnd: this.column.rowEnd,
307-
colEnd: this.column.colEnd,
308-
columnVisibleIndex: this.column.visibleIndex} : null };
301+
this.activate();
302+
}
303+
304+
/*
305+
* This method is necessary due to some specifics related with implementation of column moving
306+
* @hidden
307+
*/
308+
public activate() {
309+
this.grid.navigation.activeNode = this.activeNode;
309310
}
310311

311312
public ngDoCheck() {
@@ -325,6 +326,17 @@ export class IgxGridHeaderGroupComponent implements DoCheck {
325326
this.column.applySelectableClass = false;
326327
}
327328

329+
private get activeNode() {
330+
return {row: -1, column: this.column.visibleIndex, level: this.column.level,
331+
mchCache: {level: this.column.level, visibleIndex: this.column.visibleIndex},
332+
layout: this.column.columnLayoutChild ? {
333+
rowStart: this.column.rowStart,
334+
colStart: this.column.colStart,
335+
rowEnd: this.column.rowEnd,
336+
colEnd: this.column.colEnd,
337+
columnVisibleIndex: this.column.visibleIndex} : null };
338+
}
339+
328340
constructor(private cdr: ChangeDetectorRef,
329341
public gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>,
330342
public element: ElementRef,

0 commit comments

Comments
 (0)