Skip to content

Commit 8576070

Browse files
Remove left right arrow key shortcuts (#567)
1 parent 46e51f3 commit 8576070

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

src/components/DataSamplesTable.tsx

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

src/keyboard-shortcut-hooks.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export const keyboardShortcuts = {
1111
settings: ["ctrl+shift+p", "meta+shift+p"],
1212
focusBelowAction: ["down"],
1313
focusAboveAction: ["up"],
14-
focusActionName: ["left"],
15-
focusRecordButton: ["right"],
1614
renameAction: ["F2"],
1715
connect: ["ctrl+shift+u", "meta+shift+u"],
1816
disconnect: ["ctrl+shift+k", "meta+shift+k"],

0 commit comments

Comments
 (0)