@@ -153,12 +153,6 @@ const DataSamplesTable = ({
153153 ( idx : number ) => document . getElementById ( recordButtonId ( actions [ idx ] ) ) ,
154154 [ actions ]
155155 ) ;
156- useShortcut ( keyboardShortcuts . focusRecordButton , ( ) =>
157- recordButtonEl ( selectedActionIdx ) ?. focus ( )
158- ) ;
159- useShortcut ( keyboardShortcuts . focusActionName , ( ) =>
160- actionNameInputEl ( selectedActionIdx ) ?. focus ( )
161- ) ;
162156 const renameActionShortcutScopeRef = useShortcut (
163157 keyboardShortcuts . renameAction ,
164158 ( ) => actionNameInputEl ( selectedActionIdx ) ?. focus ( )
@@ -170,28 +164,15 @@ const DataSamplesTable = ({
170164 return ;
171165 }
172166 const nextRecordButton = recordButtonEl ( idx ) ;
173- const nextActionNameInput = actionNameInputEl ( idx ) ;
174- if ( document . activeElement === actionNameInputEl ( selectedActionIdx ) ) {
175- // When focused on an action name input.
176- return nextActionNameInput ?. focus ( ) ;
177- }
178- if (
179- document . activeElement === recordButtonEl ( selectedActionIdx ) &&
180- nextRecordButton
181- ) {
182- // When focused on a record button and next record button exists.
183- return nextRecordButton . focus ( ) ;
167+ // If record button exists, focus on it, otherwise focus on name input instead.
168+ if ( nextRecordButton ) {
169+ nextRecordButton . focus ( ) ;
170+ } else {
171+ actionNameInputEl ( idx ) ?. focus ( ) ;
184172 }
185- nextActionNameInput ?. focus ( ) ;
186173 setSelectedActionIdx ( idx ) ;
187174 } ,
188- [
189- actionNameInputEl ,
190- actions . length ,
191- recordButtonEl ,
192- selectedActionIdx ,
193- setSelectedActionIdx ,
194- ]
175+ [ actionNameInputEl , actions . length , recordButtonEl , setSelectedActionIdx ]
195176 ) ;
196177 useShortcut ( keyboardShortcuts . focusBelowAction , ( ) =>
197178 focusAction ( selectedActionIdx + 1 )
0 commit comments