File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ class TableBody extends Component {
197197
198198 handleCellKeyDown = ( e , lastEditCell ) => {
199199 e . preventDefault ( ) ;
200+ const { keyBoardNav, onNavigateCell, cellEdit } = this . props ;
200201 let offset ;
201202 if ( e . keyCode === 37 ) {
202203 offset = { x : - 1 , y : 0 } ;
@@ -212,9 +213,17 @@ class TableBody extends Component {
212213 }
213214 } else if ( e . keyCode === 40 ) {
214215 offset = { x : 0 , y : 1 } ;
216+ } else if ( e . keyCode === 13 ) {
217+ const enterToEdit = typeof keyBoardNav === 'object' ?
218+ keyBoardNav . enterToEdit :
219+ false ;
220+ if ( cellEdit && enterToEdit ) {
221+ this . handleEditCell ( e . target . parentElement . rowIndex + 1 ,
222+ e . currentTarget . cellIndex , '' , e ) ;
223+ }
215224 }
216- if ( offset && this . props . keyBoardNav ) {
217- this . props . onNavigateCell ( offset ) ;
225+ if ( offset && keyBoardNav ) {
226+ onNavigateCell ( offset ) ;
218227 }
219228 }
220229
You can’t perform that action at this time.
0 commit comments