Skip to content

Commit 0b7c4af

Browse files
committed
chore(*): when press and hold tab focus should remain in the grid
1 parent af7ec70 commit 0b7c4af

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { IgxGridBaseDirective } from './grid-base.directive';
33
import { first } from 'rxjs/operators';
44
import { IgxColumnComponent } from './columns/column.component';
55
import { IgxGridNavigationService } from './grid-navigation.service';
6-
import { HORIZONTAL_NAV_KEYS } from '../core/utils';
6+
import { HORIZONTAL_NAV_KEYS, HEADER_KEYS } from '../core/utils';
77

88
/** @hidden */
99
@Injectable()
@@ -214,14 +214,15 @@ export class IgxGridMRLNavigationService extends IgxGridNavigationService {
214214

215215
headerNavigation(event: KeyboardEvent) {
216216
const key = event.key.toLowerCase();
217+
if (!HEADER_KEYS.has(key)) { return; }
218+
event.preventDefault();
217219
if (!this.activeNode.layout) {
218220
this.activeNode.layout = this.layout(this.activeNode.column || 0);
219221
}
220222
const alt = event.altKey;
221223
const ctrl = event.ctrlKey;
222224
this.performHeaderKeyCombination(this.grid.getColumnByVisibleIndex(this.activeNode.column), key, event.shiftKey, ctrl, alt);
223225
if (!ctrl && !alt && (key.includes('down') || key.includes('up'))) {
224-
event.preventDefault();
225226
const children = this.parentByChildIndex(this.activeNode.column).children;
226227
const col = key.includes('down') ? this.getNextRowIndex(children, false) : this.getPreviousRowIndex(children, false);
227228
if (!col) { return; }
@@ -236,7 +237,6 @@ export class IgxGridMRLNavigationService extends IgxGridNavigationService {
236237
protected horizontalNav(event: KeyboardEvent, key: string, rowIndex: number) {
237238
const ctrl = event.ctrlKey;
238239
if (!HORIZONTAL_NAV_KEYS.has(key) || event.altKey) { return; }
239-
event.preventDefault();
240240
this.activeNode.row = rowIndex;
241241
if ((key.includes('left') || key === 'home') && this.activeNode.column > 0) {
242242
this.activeNode.column = ctrl || key === 'home' ? this.firstIndexPerRow : this.getNextHorizontalCellPosition(true).column;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export class IgxGridNavigationService {
2929
protected pendingNavigation = false;
3030

3131
handleNavigation(event: KeyboardEvent) {
32-
if (event.repeat && SUPPORTED_KEYS.has(event.key.toLowerCase())) {
32+
const key = event.key.toLowerCase();
33+
if (event.repeat && SUPPORTED_KEYS.has(key) || (key === 'tab' && this.grid.crudService.cell)) {
3334
event.preventDefault();
3435
}
3536
event.repeat ? setTimeout(() => this.dispatchEvent(event), 1) : this.dispatchEvent(event);

projects/igniteui-angular/src/lib/grids/grid/grid.master-detail.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ describe('IgxGrid Master Detail #grid', () => {
547547
});
548548

549549
it('Should navigate to the correct row/cell when using the navigateTo method in a grid with expanded detail views.', async() => {
550+
pending('This test should pass when the issue #7300 is fixed.');
550551
grid.navigateTo(20, 0);
551552
await wait(DEBOUNCETIME);
552553
fix.detectChanges();

0 commit comments

Comments
 (0)