Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ export class IgxGridMRLNavigationService extends IgxGridNavigationService {

private hasNextVerticalPosition(prev = false) {
if ((prev && this.activeNode.row === 0 && (!this.isDataRow(this.activeNode.row) || this.activeNode.layout.rowStart === 1)) ||
(!prev && this.activeNode.row >= this.grid.dataView.length - 1 && this.activeNode.column === this.lastColIndexPerMRLBlock())) {
(!prev && this.activeNode.row >= this.grid.dataView.length - 1 &&
this.activeNode.layout.rowStart === this.lastRowStartPerBlock())) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,40 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
GridFunctions.verifyGridContentActiveDescendant(GridFunctions.getGridContent(fix), cell.nativeElement.id);
});

it('should not return an out of bounds row index when navigating down from the last layout row', () => {
fix.componentInstance.data = SampleTestData.contactInfoDataFull().slice(0, 10);
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 10 for the data slice limit is unexplained. Consider extracting it as a named constant (e.g., const TEST_DATA_SIZE = 10;) to clarify why this specific number of records is needed for the test.

Copilot uses AI. Check for mistakes.
fix.componentInstance.colGroups = [{
group: 'group1',
columns: [
{ field: 'ID', rowStart: 1, colStart: 1 },
{ field: 'CompanyName', rowStart: 1, colStart: 2 },
{ field: 'ContactName', rowStart: 1, colStart: 3 },
{ field: 'ContactTitle', rowStart: 1, colStart: 4 },
{ field: 'Address', rowStart: 1, colStart: 5 },
{ field: 'City', rowStart: 2, colStart: 1 },
{ field: 'Region', rowStart: 2, colStart: 2 },
{ field: 'PostalCode', rowStart: 2, colStart: 3 },
{ field: 'Phone', rowStart: 2, colStart: 4 },
{ field: 'Fax', rowStart: 2, colStart: 5 }
]
}];
fix.detectChanges();

const grid = fix.componentInstance.grid;
const lastRowIndex = grid.dataView.length - 1;
const navService = grid.navigation as IgxGridMRLNavigationService;
const col = grid.getColumnByName('City');
navService.setActiveNode({
row: lastRowIndex,
column: col.visibleIndex,
layout: navService.layout(col.visibleIndex)
});

const nextPos = navService.getNextVerticalPosition();
expect(nextPos.row).toBe(lastRowIndex);
expect(nextPos.column).toBe(navService.activeNode.column);
});

it('should navigate up correctly', () => {
fix.componentInstance.colGroups = [{
group: 'group1',
Expand Down
Loading