Skip to content
Merged
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 @@ -109,11 +109,15 @@ export class IgxGridNavigationService {
this.grid.selectionService.keyboardStateOnKeydown(this.activeNode as ISelectionNode, shift, shift && key === 'tab');
}
const position = this.getNextPosition(this.activeNode.row, this.activeNode.column!, key, shift, ctrl, event);
// Keys without a target position (e.g. row-add keys without alt) need no further handling.
if (!position) {
return;
Comment thread
mddragnev marked this conversation as resolved.
}
const shouldNotifyVirtualizedKeyboardSelection =
this.shouldNotifyVirtualizedKeyboardSelection(key, position!.rowIndex, position!.colIndex);
this.shouldNotifyVirtualizedKeyboardSelection(key, position.rowIndex, position.colIndex);
if (NAVIGATION_KEYS.has(key)) {
event.preventDefault();
this.navigateInBody(position!.rowIndex, position!.colIndex, (obj) => {
this.navigateInBody(position.rowIndex, position.colIndex, (obj) => {
obj.target.activate(event);
if (shouldNotifyVirtualizedKeyboardSelection) {
this.grid.notifyChanges();
Expand Down
22 changes: 22 additions & 0 deletions projects/igniteui-angular/grids/grid/src/grid-cell-editing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,28 @@ describe('IgxGrid - Cell Editing #grid', () => {
expect((document.activeElement as HTMLInputElement).selectionEnd).toEqual(10)
}));

it('should not throw or block typing + and = in the cell editor', fakeAsync(() => {
const cell = grid.gridAPI.get_cell_by_index(0, 'fullName');

UIInteractions.simulateDoubleClickAndSelectEvent(cell);
fixture.detectChanges();
tick(100);
expect(cell.editMode).toBe(true);

const editor = document.activeElement as HTMLInputElement;
expect(editor.nodeName).toEqual('INPUT');

['+', '='].forEach(key => {
const event = new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true });
expect(() => {
editor.dispatchEvent(event);
fixture.detectChanges();
}).not.toThrow();
Comment thread
mddragnev marked this conversation as resolved.
expect(event.defaultPrevented).toBe(false);
expect(cell.editMode).toBe(true);
});
}));

it('should work correct when not using ngModel but value and change event', fakeAsync(() => {
fixture = TestBed.createComponent(CellEditingCustomEditorTestComponent);
fixture.detectChanges();
Expand Down
17 changes: 17 additions & 0 deletions projects/igniteui-angular/grids/grid/src/grid-keyBoardNav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,23 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
expect(selectedCell.value).toEqual('Company A');
expect(selectedCell.column.field).toMatch('Company');
});

it('should ignore + and = on a focused cell, with or without ctrl', () => {
GridFunctions.focusFirstCell(fix, grid);
fix.detectChanges();
const activeNode = { ...grid.navigation.activeNode };

['+', '='].forEach(key => {
[false, true].forEach(ctrlKey => {
const event = new KeyboardEvent('keydown', { key, ctrlKey, bubbles: true, cancelable: true });
expect(() => grid.navigation.handleNavigation(event)).not.toThrow();
Comment thread
mddragnev marked this conversation as resolved.
fix.detectChanges();
expect(event.defaultPrevented).toBe(false);
expect(grid.navigation.activeNode.row).toBe(activeNode.row);
expect(grid.navigation.activeNode.column).toBe(activeNode.column);
});
});
});
});

describe('in virtualized grid', () => {
Expand Down
Loading