@@ -128,28 +128,22 @@ const DataGridOverlayEditor: React.FunctionComponent<DataGridOverlayEditorProps>
128128 const onKeyDown = React . useCallback (
129129 async ( event : React . KeyboardEvent ) => {
130130 let save = false ;
131- switch ( event . key ) {
132- case "Escape" : {
133- event . stopPropagation ( ) ;
134- event . preventDefault ( ) ;
135- customMotion . current = [ 0 , 0 ] ;
136- break ;
137- }
138- case "Enter" : {
139- event . stopPropagation ( ) ;
140- event . preventDefault ( ) ;
141- customMotion . current = [ 0 , event . shiftKey ? - 1 : 1 ] ;
142- save = true ;
143- break ;
144- }
145- case "Tab" : {
146- event . stopPropagation ( ) ;
147- event . preventDefault ( ) ;
148- customMotion . current = [ event . shiftKey ? - 1 : 1 , 0 ] ;
149- save = true ;
150- break ;
151- }
131+ if ( event . key === "Escape" ) {
132+ event . stopPropagation ( ) ;
133+ event . preventDefault ( ) ;
134+ customMotion . current = [ 0 , 0 ] ;
135+ } else if ( event . key === "Enter" && ! event . shiftKey ) {
136+ event . stopPropagation ( ) ;
137+ event . preventDefault ( ) ;
138+ customMotion . current = [ 0 , 1 ] ;
139+ save = true ;
140+ } else if ( event . key === "Tab" ) {
141+ event . stopPropagation ( ) ;
142+ event . preventDefault ( ) ;
143+ customMotion . current = [ event . shiftKey ? - 1 : 1 , 0 ] ;
144+ save = true ;
152145 }
146+
153147 window . setTimeout ( ( ) => {
154148 if ( ! finished . current && customMotion . current !== undefined ) {
155149 onFinishEditing ( save ? tempValue : undefined , customMotion . current ) ;
0 commit comments