Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove duplicate arrow up/down key handling
  • Loading branch information
eps1lon committed Dec 16, 2020
commit c1b9f2da1d298543391faed4c0f3faba75f1a504
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,6 @@ export default function SearchInput(props: Props) {
[dispatch],
);

const handleKeyDown = useCallback(
event => {
// For convenience, let up/down arrow keys change Tree selection.
switch (event.key) {
case 'ArrowDown':
dispatch({type: 'SELECT_NEXT_ELEMENT_IN_TREE'});
event.preventDefault();
break;
case 'ArrowUp':
dispatch({type: 'SELECT_PREVIOUS_ELEMENT_IN_TREE'});
event.preventDefault();
break;
default:
break;
}
},
[dispatch],
);

const handleInputKeyPress = useCallback(
({key, shiftKey}) => {
if (key === 'Enter') {
Expand Down Expand Up @@ -98,7 +79,6 @@ export default function SearchInput(props: Props) {
<input
className={styles.Input}
onChange={handleTextChange}
onKeyDown={handleKeyDown}
onKeyPress={handleInputKeyPress}
placeholder="Search (text or /regex/)"
ref={inputRef}
Expand Down