Skip to content

Commit aa9c344

Browse files
committed
[update] the keyboard navigation section for grid
1 parent 733a2dc commit aa9c344

File tree

3 files changed

+214
-45
lines changed

3 files changed

+214
-45
lines changed

docs/grid/configuration.md

Lines changed: 121 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,25 +2980,25 @@ DHTMLX Grid provides the keyboard navigation that will help you manipulate your
29802980

29812981
### Default shortcut keys
29822982

2983-
There are four navigation keys that Grid enables by default:
2983+
The navigation shortcut keys and keys combinations that Grid enables by default are provided below:
29842984

29852985
<table>
29862986
<tbody>
29872987
<tr>
29882988
<td><b>PageUp</b></td>
2989-
<td>scroll Grid up to the height of the visible content (without change of the selected cell)</td>
2989+
<td>scrolls Grid up to the height of the visible content (without change of the selected cell)</td>
29902990
</tr>
29912991
<tr>
29922992
<td><b>PageDown</b></td>
2993-
<td>scroll Grid down to the height of the visible content (without change of the selected cell)</td>
2993+
<td>scrolls Grid down to the height of the visible content (without change of the selected cell)</td>
29942994
</tr>
29952995
<tr>
29962996
<td><b>Home</b></td>
2997-
<td>navigate to the beginning of the Grid content (without change of the selected cell)</td>
2997+
<td>navigates to the beginning of the Grid content (without change of the selected cell)</td>
29982998
</tr>
29992999
<tr>
30003000
<td><b>End</b></td>
3001-
<td>navigate to the end of the Grid content (without change of the selected cell)</td>
3001+
<td>navigates to the end of the Grid content (without change of the selected cell)</td>
30023002
</tr>
30033003
<tr>
30043004
<td><b>Ctrl+Enter</b></td>
@@ -3021,9 +3021,9 @@ const grid = new dhx.Grid("grid_container", {
30213021

30223022
**Related sample**: [Grid. Key navigation](https://snippet.dhtmlx.com/y9kdk0md)
30233023

3024-
### Arrow shortcut keys
3024+
### Shortcut keys for moving selection between cells
30253025

3026-
In case you want to enable the arrow keys that allow moving the selection between cells, you need to specify the [`selection`](grid/api/grid_selection_config.md) property for Grid.
3026+
In case you want to enable the shortcut keys that allow moving the selection between cells, you need to specify the [`selection`](grid/api/grid_selection_config.md) property for Grid.
30273027

30283028
~~~jsx {6}
30293029
const grid = new dhx.Grid("grid_container", {
@@ -3038,95 +3038,95 @@ const grid = new dhx.Grid("grid_container", {
30383038

30393039
**Related sample**: [Grid. Key navigation](https://snippet.dhtmlx.com/y9kdk0md)
30403040

3041-
The list of the arrow shortcut keys:
3041+
The list of the shortcut keys and their combinations used for moving selection between cells is the following:
30423042

30433043
<table>
30443044
<tbody>
30453045
<tr>
30463046
<td><b>ArrowUp</b></td>
3047-
<td>move selection to the previous vertical cell</td>
3047+
<td>moves selection to the previous vertical cell</td>
30483048
</tr>
30493049
<tr>
30503050
<td><b>ArrowDown</b></td>
3051-
<td>move selection to the next vertical cell</td>
3051+
<td>moves selection to the next vertical cell</td>
30523052
</tr>
30533053
<tr>
30543054
<td><b>ArrowLeft</b></td>
3055-
<td>move selection to the previous horizontal cell</td>
3055+
<td>moves selection to the previous horizontal cell</td>
30563056
</tr>
30573057
<tr>
30583058
<td><b>ArrowRight</b></td>
3059-
<td>move selection to the next horizontal cell</td>
3059+
<td>moves selection to the next horizontal cell</td>
30603060
</tr>
30613061
<tr>
30623062
<td><b>Ctrl+ArrowUp</b></td>
3063-
<td>move selection to the first vertical cell</td>
3063+
<td>moves selection to the first vertical cell</td>
30643064
</tr>
30653065
<tr>
30663066
<td><b>Ctrl+ArrowDown</b></td>
3067-
<td>move selection to the last vertical cell</td>
3067+
<td>moves selection to the last vertical cell</td>
30683068
</tr>
30693069
<tr>
30703070
<td><b>Ctrl+ArrowLeft</b></td>
3071-
<td> move selection to the first horizontal cell</td>
3071+
<td> moves selection to the first horizontal cell</td>
30723072
</tr>
30733073
<tr>
30743074
<td><b>Ctrl+ArrowRight</b></td>
3075-
<td> move selection to the last horizontal cell</td>
3075+
<td> moves selection to the last horizontal cell</td>
30763076
</tr>
30773077
<tr>
30783078
<td><b>Tab</b></td>
3079-
<td> move selection to the next horizontal cell or the first cell of the next row</td>
3079+
<td> moves selection to the next horizontal cell or the first cell of the next row</td>
30803080
</tr>
30813081
<tr>
30823082
<td><b>Shit+Tab</b></td>
3083-
<td> move selection to the previous horizontal cell or to the first cell of the previous row</td>
3083+
<td> moves selection to the previous horizontal cell or to the first cell of the previous row</td>
30843084
</tr>
30853085
</tbody>
30863086
</table>
30873087

3088-
The arrow shortcut keys listed below do not work when the `selection` property is set to *"complex"*. Use another mode (*"cell" or "row"*) in case you want to activate these navigation keys:
3088+
The combinations of the shortcut keys listed below do not work when the `selection` property is set to *"complex"*. Use another mode (*"cell" or "row"*) in case you want to activate these navigation keys:
30893089

30903090
<table>
30913091
<tbody>
30923092
<tr>
30933093
<td><b>Shift+ArrowUp</b></td>
3094-
<td>move selection to the previous vertical cell with the change of the selected cells</td>
3094+
<td>moves selection to the previous vertical cell with the change of the selected cells</td>
30953095
</tr>
30963096
<tr>
30973097
<td><b>Shift+ArrowDown</b></td>
3098-
<td>move selection to the next vertical cell with the change of the selected cells</td>
3098+
<td>moves selection to the next vertical cell with the change of the selected cells</td>
30993099
</tr>
31003100
<tr>
31013101
<td><b>Shift+ArrowLeft</b></td>
3102-
<td>move selection to the previous horizontal cell with the change of the selected cells</td>
3102+
<td>moves selection to the previous horizontal cell with the change of the selected cells</td>
31033103
</tr>
31043104
<tr>
31053105
<td><b>Shift+ArrowRight</b></td>
3106-
<td>move selection to the next horizontal cell with the change of the selected cells</td>
3106+
<td>moves selection to the next horizontal cell with the change of the selected cells</td>
31073107
</tr>
31083108
<tr>
31093109
<td><b>Ctrl+Shift+ArrowUp</b></td>
3110-
<td>move selection to the first vertical cell with the change of the selected cells</td>
3110+
<td>moves selection to the first vertical cell with the change of the selected cells</td>
31113111
</tr>
31123112
<tr>
31133113
<td><b>Ctrl+Shift+ArrowDown</b></td>
3114-
<td>move selection to the last vertical cell with the change of the selected cells</td>
3114+
<td>moves selection to the last vertical cell with the change of the selected cells</td>
31153115
</tr>
31163116
<tr>
31173117
<td><b>Ctrl+Shift+ArrowLeft</b></td>
3118-
<td>move selection to the first horizontal cell with the change of the selected cells</td>
3118+
<td>moves selection to the first horizontal cell with the change of the selected cells</td>
31193119
</tr>
31203120
<tr>
31213121
<td><b>Ctrl+Shift+ArrowRight</b></td>
3122-
<td>move selection to the last horizontal cell with the change of the selected cells</td>
3122+
<td>moves selection to the last horizontal cell with the change of the selected cells</td>
31233123
</tr>
31243124
</tbody>
31253125
</table>
31263126

31273127
### Shortcut keys for editing
31283128

3129-
It is also possible to use shortcut keys for editing a cell in Grid by setting [`editable:true`](grid/api/grid_editable_config.md) property in the configuration object of Grid.
3129+
It is possible to use shortcut keys for editing a cell in Grid by setting the [`editable:true`](grid/api/grid_editable_config.md) property in the configuration object of Grid.
31303130

31313131
~~~jsx {7}
31323132
const grid = new dhx.Grid("grid_container", {
@@ -3142,17 +3142,17 @@ const grid = new dhx.Grid("grid_container", {
31423142

31433143
**Related sample**: [Grid. Key navigation](https://snippet.dhtmlx.com/y9kdk0md)
31443144

3145-
The list of the shortcut keys for editing:
3145+
The list of the shortcut keys for editing is given below:
31463146

31473147
<table>
31483148
<tbody>
31493149
<tr>
31503150
<td><b>Enter</b></td>
3151-
<td>open the editor in the selected cell. If the editor is currently opened - close the editor and save changes</td>
3151+
<td>opens the editor in the selected cell. If the editor is currently opened - closes the editor and saves changes</td>
31523152
</tr>
31533153
<tr>
31543154
<td><b>Escape</b></td>
3155-
<td>close the editor of the selected cell without saving</td>
3155+
<td>closes the editor of the selected cell without saving</td>
31563156
</tr>
31573157
<tr>
31583158
<td><b>Delete</b></td>
@@ -3161,20 +3161,103 @@ The list of the shortcut keys for editing:
31613161
</tbody>
31623162
</table>
31633163

3164-
### Selecting ranges of cells
3164+
### Shortcut keys for selecting ranges of cells
31653165

31663166
If you need to use the keyboard navigation for selecting ranges of cells via the user interface, you should enable the [`BlockSelection`](grid/usage_blockselection.md) module in the Grid configuration.
31673167

31683168
:::note
31693169
Keyboard navigation works in both the `"range"` and `"manual"` modes. In the `"manual"` mode, applying the selection (e.g., after `Enter`) requires handling via the events, such as [`beforeBlockSelectionApply`](grid/api/blockselection/beforeblockselectionapply_event.md) and [`afterBlockSelectionApply`](grid/api/blockselection/afterblockselectionapply_event.md).
31703170
:::
31713171

3172-
- The module supports keyboard navigation for selecting and managing ranges, similar to keyboard navigation used in Google Spreadsheets:
3173-
- **Arrows** (`ArrowUp`, `ArrowDown`, `ArrowLeft`, `ArrowRight`): moves the focus to the adjacent cell, setting the initially selected cell if no selection is active.
3174-
- **Shift + Arrows**: extends the selected range from the current initial cell in the direction of the pressed arrow.
3175-
- **Ctrl + Arrows**: extends the selected range to the last cell in the direction of the pressed arrow.
3172+
The module supports keyboard navigation for selecting and managing ranges, similar to keyboard navigation used in Google Spreadsheets. The following shortcut keys and their combinations are available:
31763173

3177-
- The **Shift + click** combination sets the end cell of the range, extending the selection from the current initial cell.
3174+
<table>
3175+
<tbody>
3176+
<tr>
3177+
<td><b>ArrowUp</b></td>
3178+
<td>resets the selected range and moves the focus to the previous vertical cell, setting the initially selected cell if no selection is active</td>
3179+
</tr>
3180+
<tr>
3181+
<td><b>ArrowDown</b></td>
3182+
<td>resets the selected range and moves the focus to the next vertical cell, setting the initially selected cell if no selection is active</td>
3183+
</tr>
3184+
<tr>
3185+
<td><b>ArrowLeft</b></td>
3186+
<td>resets the selected range and moves the focus to the previous horizontal cell, setting the initially selected cell if no selection is active</td>
3187+
</tr>
3188+
<tr>
3189+
<td><b>ArrowRight</b></td>
3190+
<td>resets the selected range and moves the focus to the next horizontal cell, setting the initially selected cell if no selection is active</td>
3191+
</tr>
3192+
<tr>
3193+
<td><b>Shift+ArrowUp</b></td>
3194+
<td>extends the selected range from the current initial cell to the previous vertical cell</td>
3195+
</tr>
3196+
<tr>
3197+
<td><b>Shift+ArrowDown</b></td>
3198+
<td>extends the selected range from the current initial cell to the next vertical cell </td>
3199+
</tr>
3200+
<tr>
3201+
<td><b>Shift+ArrowLeft</b></td>
3202+
<td>extends the selected range from the current initial cell to the previous horizontal cell </td>
3203+
</tr>
3204+
<tr>
3205+
<td><b>Shift+ArrowRight</b></td>
3206+
<td>extends the selected range from the current initial cell to the next horizontal cell </td>
3207+
</tr>
3208+
<tr>
3209+
<td><b>Ctrl+ArrowUp</b></td>
3210+
<td>resets the selected range and moves the focus to the first vertical cell</td>
3211+
</tr>
3212+
<tr>
3213+
<td><b>Ctrl+ArrowDown</b></td>
3214+
<td>resets the selected range and moves the focus to the last vertical cell</td>
3215+
</tr>
3216+
<tr>
3217+
<td><b>Ctrl+ArrowLeft</b></td>
3218+
<td>resets the selected range and moves the focus to the first horizontal cell</td>
3219+
</tr>
3220+
<tr>
3221+
<td><b>Ctrl+ArrowRight</b></td>
3222+
<td>resets the selected range and moves the focus to the last horizontal cell</td>
3223+
</tr>
3224+
<tr>
3225+
<td><b>Ctrl+Shift+ArrowUp</b></td>
3226+
<td>extends the selected range to the first vertical cell</td>
3227+
</tr>
3228+
<tr>
3229+
<td><b>Ctrl+Shift+ArrowDown</b></td>
3230+
<td>extends the selected range to the last vertical cell</td>
3231+
</tr>
3232+
<tr>
3233+
<td><b>Ctrl+Shift+ArrowLeft</b></td>
3234+
<td> extends the selected range to the first horizontal cell</td>
3235+
</tr>
3236+
<tr>
3237+
<td><b>Ctrl+Shift+ArrowRight</b></td>
3238+
<td> extends the selected range to the last horizontal cell</td>
3239+
</tr>
3240+
</tbody>
3241+
</table>
3242+
3243+
The following shortcut key and mouse combination is available:
3244+
3245+
<table>
3246+
<tbody>
3247+
<tr>
3248+
<td><b>Shift + click</b></td>
3249+
<td>sets the end cell of the range, extending the selection from the current initial cell</td>
3250+
</tr>
3251+
</tbody>
3252+
</table>
31783253

3179-
- The **Delete** shortcut key allows clearing the selected cells when the [`editable` mode](grid/api/grid_editable_config.md) is set for the Grid component and the `BlockSelection` module is used in the `"range"` mode.
3254+
The following shortcut key is available when the [`editable` mode](grid/api/grid_editable_config.md) is set for the Grid component and the `BlockSelection` module is used in the `"range"` mode:
31803255

3256+
<table>
3257+
<tbody>
3258+
<tr>
3259+
<td><b>Delete</b></td>
3260+
<td>allows clearing the selected cells</td>
3261+
</tr>
3262+
</tbody>
3263+
</table>

docs/grid/usage_blockselection.md

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,99 @@ The main points of cell selection while using the `BlockSelection` module are gi
123123
Keyboard navigation works in both the `"range"` and `"manual"` modes. In the `"manual"` mode, applying the selection (e.g., after `Enter`) requires handling via the events, such as [`beforeBlockSelectionApply`](grid/api/blockselection/beforeblockselectionapply_event.md) and [`afterBlockSelectionApply`](grid/api/blockselection/afterblockselectionapply_event.md).
124124
:::
125125

126-
- The module supports keyboard navigation for selecting and managing ranges, similar to keyboard navigation used in Google Spreadsheets:
127-
- **Arrows** (`ArrowUp`, `ArrowDown`, `ArrowLeft`, `ArrowRight`): moves the focus to the adjacent cell, setting the initially selected cell if no selection is active.
128-
- **Shift + Arrows**: extends the selected range from the current initial cell in the direction of the pressed arrow.
129-
- **Ctrl + Arrows**: extends the selected range to the last cell in the direction of the pressed arrow.
126+
The module supports keyboard navigation for selecting and managing ranges, similar to keyboard navigation used in Google Spreadsheets. The following shortcut keys and their combinations are available:
127+
128+
<table>
129+
<tbody>
130+
<tr>
131+
<td><b>ArrowUp</b></td>
132+
<td>resets the selected range and moves the focus to the previous vertical cell, setting the initially selected cell if no selection is active</td>
133+
</tr>
134+
<tr>
135+
<td><b>ArrowDown</b></td>
136+
<td>resets the selected range and moves the focus to the next vertical cell, setting the initially selected cell if no selection is active</td>
137+
</tr>
138+
<tr>
139+
<td><b>ArrowLeft</b></td>
140+
<td>resets the selected range and moves the focus to the previous horizontal cell, setting the initially selected cell if no selection is active</td>
141+
</tr>
142+
<tr>
143+
<td><b>ArrowRight</b></td>
144+
<td>resets the selected range and moves the focus to the next horizontal cell, setting the initially selected cell if no selection is active</td>
145+
</tr>
146+
<tr>
147+
<td><b>Shift+ArrowUp</b></td>
148+
<td>extends the selected range from the current initial cell to the previous vertical cell</td>
149+
</tr>
150+
<tr>
151+
<td><b>Shift+ArrowDown</b></td>
152+
<td>extends the selected range from the current initial cell to the next vertical cell </td>
153+
</tr>
154+
<tr>
155+
<td><b>Shift+ArrowLeft</b></td>
156+
<td>extends the selected range from the current initial cell to the previous horizontal cell </td>
157+
</tr>
158+
<tr>
159+
<td><b>Shift+ArrowRight</b></td>
160+
<td>extends the selected range from the current initial cell to the next horizontal cell </td>
161+
</tr>
162+
<tr>
163+
<td><b>Ctrl+ArrowUp</b></td>
164+
<td>resets the selected range and moves the focus to the first vertical cell</td>
165+
</tr>
166+
<tr>
167+
<td><b>Ctrl+ArrowDown</b></td>
168+
<td>resets the selected range and moves the focus to the last vertical cell</td>
169+
</tr>
170+
<tr>
171+
<td><b>Ctrl+ArrowLeft</b></td>
172+
<td>resets the selected range and moves the focus to the first horizontal cell</td>
173+
</tr>
174+
<tr>
175+
<td><b>Ctrl+ArrowRight</b></td>
176+
<td>resets the selected range and moves the focus to the last horizontal cell</td>
177+
</tr>
178+
<tr>
179+
<td><b>Ctrl+Shift+ArrowUp</b></td>
180+
<td>extends the selected range to the first vertical cell</td>
181+
</tr>
182+
<tr>
183+
<td><b>Ctrl+Shift+ArrowDown</b></td>
184+
<td>extends the selected range to the last vertical cell</td>
185+
</tr>
186+
<tr>
187+
<td><b>Ctrl+Shift+ArrowLeft</b></td>
188+
<td> extends the selected range to the first horizontal cell</td>
189+
</tr>
190+
<tr>
191+
<td><b>Ctrl+Shift+ArrowRight</b></td>
192+
<td> extends the selected range to the last horizontal cell</td>
193+
</tr>
194+
</tbody>
195+
</table>
196+
197+
The following shortcut key and mouse combination is available:
198+
199+
<table>
200+
<tbody>
201+
<tr>
202+
<td><b>Shift + click</b></td>
203+
<td>sets the end cell of the range, extending the selection from the current initial cell</td>
204+
</tr>
205+
</tbody>
206+
</table>
207+
208+
The following shortcut key is available when the [`editable` mode](grid/api/grid_editable_config.md) is set for the Grid component and the `BlockSelection` module is used in the `"range"` mode:
209+
210+
<table>
211+
<tbody>
212+
<tr>
213+
<td><b>Delete</b></td>
214+
<td>allows clearing the selected cells</td>
215+
</tr>
216+
</tbody>
217+
</table>
130218

131-
- The **Shift + click** combination sets the end cell of the range, extending the selection from the current initial cell.
132-
133-
- The **Delete** shortcut key allows clearing the selected cells when the [`editable` mode](grid/api/grid_editable_config.md) is set for the Grid component and the `BlockSelection` module is used in the `"range"` mode.
134219
It is possible to cancel the cells clearing by using the [`beforeKeyDown`](grid/api/grid_beforekeydown_event.md) event:
135220

136221
~~~jsx

0 commit comments

Comments
 (0)