Skip to content

Commit 5fd2317

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Prevent ctrl+arrow keys on splitter bar.
1 parent 38fd2db commit 5fd2317

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

projects/igniteui-angular/src/lib/splitter/splitter-bar/splitter-bar.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { SplitterType } from '../splitter.component';
33
import { IgxSplitterPaneComponent } from '../splitter-pane/splitter-pane.component';
44
import { IDragMoveEventArgs, IDragStartEventArgs, DragDirection } from '../../directives/drag-drop/drag-drop.directive';
55

6+
7+
export const SPLITTER_INTERACTION_KEYS = new Set('right down left up arrowright arrowdown arrowleft arrowup'.split(' '));
8+
69
/**
710
* Provides reference to `SplitBarComponent` component.
811
* Represents the draggable gripper that visually separates panes and allows for changing their sizes.
@@ -91,8 +94,12 @@ export class IgxSplitBarComponent {
9194
const key = event.key.toLowerCase();
9295
const ctrl = event.ctrlKey;
9396
event.stopPropagation();
97+
if (SPLITTER_INTERACTION_KEYS.has(key)) {
98+
event.preventDefault();
99+
}
94100
switch (key) {
95101
case 'arrowup':
102+
case 'up':
96103
if (this.type === SplitterType.Vertical) {
97104
if (ctrl) {
98105
this.onCollapsing(false);
@@ -106,6 +113,7 @@ export class IgxSplitBarComponent {
106113
}
107114
break;
108115
case 'arrowdown':
116+
case 'down':
109117
if (this.type === SplitterType.Vertical) {
110118
if (ctrl) {
111119
this.onCollapsing(true);
@@ -119,6 +127,7 @@ export class IgxSplitBarComponent {
119127
}
120128
break;
121129
case 'arrowleft':
130+
case 'left':
122131
if (this.type === SplitterType.Horizontal) {
123132
if (ctrl) {
124133
this.onCollapsing(false);
@@ -132,6 +141,7 @@ export class IgxSplitBarComponent {
132141
}
133142
break;
134143
case 'arrowright':
144+
case 'right':
135145
if (this.type === SplitterType.Horizontal) {
136146
if (ctrl) {
137147
this.onCollapsing(true);

0 commit comments

Comments
 (0)