Skip to content

Commit 2423251

Browse files
authored
Merge pull request #6033 from IgniteUI/mdragnev/fix-4780-master
fix(igxHierarchicalGrid): Fix navigation with tab is not correct #4780
2 parents 05c9de8 + 3e467b2 commit 2423251

File tree

7 files changed

+32
-5
lines changed

7 files changed

+32
-5
lines changed

projects/igniteui-angular/src/lib/grids/common/grid.interface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export interface IGridDataBindable {
1010
* @internal
1111
*/
1212
export interface GridType extends IGridDataBindable {
13-
id: string;
1413
nativeElement: HTMLElement;
1514
rowEditable: boolean;
1615
rootSummariesEnabled: boolean;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ export class IgxGridNavigationService {
628628

629629
protected getNextRowByIndex(nextIndex) {
630630
return this.grid.tbody.nativeElement.querySelector(
631-
`[data-rowindex="${nextIndex}"][data-gridid="${this.grid.id}"]`);
631+
`[data-rowindex="${nextIndex}"]`);
632632
}
633633

634634
private getAllRows() {

projects/igniteui-angular/src/lib/grids/grid/groupby-row.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export class IgxGridGroupByRowComponent {
8484
* ```
8585
*/
8686
@Input()
87-
@HostBinding('attr.data-gridID')
8887
public gridID: string;
8988

9089
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,4 +808,8 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
808808
}
809809
return null;
810810
}
811+
812+
protected getNextRowByIndex(nextIndex) {
813+
return this.grid.dataRowList.find(element => element.index === nextIndex).element.nativeElement;
814+
}
811815
}

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,33 @@ describe('IgxHierarchicalGrid Complex Navigation #hGrid', () => {
916916
expect(lastCell.rowIndex).toBe(4);
917917

918918
}));
919+
920+
it('should navigate to the first cell of next row using Tab from last cell in the row above', (async () => {
921+
hierarchicalGrid.expandChildren = false;
922+
hierarchicalGrid.height = '600px';
923+
hierarchicalGrid.width = '1000px';
924+
fixture.componentInstance.rowIsland.height = '350px';
925+
fixture.detectChanges();
926+
await wait(100);
927+
928+
const row = hierarchicalGrid.getRowByIndex(0);
929+
(row as IgxHierarchicalRowComponent).toggle();
930+
await wait(100);
931+
fixture.detectChanges();
932+
933+
const cell = hierarchicalGrid.getCellByColumn(2, 'childData2');
934+
cell.nativeElement.dispatchEvent(new Event('focus'));
935+
await wait(100);
936+
fixture.detectChanges();
937+
938+
UIInteractions.triggerKeyDownEvtUponElem('Tab', cell.nativeElement, true);
939+
await wait(100);
940+
fixture.detectChanges();
941+
942+
const currentCell = hierarchicalGrid.getCellByColumn(3, 'ID');
943+
expect(currentCell.focused).toBe(true);
944+
expect(currentCell.rowIndex).toBe(3);
945+
}));
919946
});
920947

921948
describe('IgxHierarchicalGrid Multi-layout Navigation #hGrid', () => {

projects/igniteui-angular/src/lib/grids/row.directive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
6262
* @hidden
6363
*/
6464
@Input()
65-
@HostBinding('attr.data-gridID')
6665
public gridID: string;
6766

6867
/**

projects/igniteui-angular/src/lib/grids/summaries/summary-row.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export class IgxSummaryRowComponent implements DoCheck {
3333
public summaries: Map<string, IgxSummaryResult[]>;
3434

3535
@Input()
36-
@HostBinding('attr.data-gridID')
3736
public gridID;
3837

3938
@Input()

0 commit comments

Comments
 (0)