Skip to content

Commit

Permalink
Fix Cmd/Ctrl-f not focusing find bar input
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Sep 19, 2024
1 parent e00c5c4 commit 0f15a7f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/findbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ function Findbar({ searchState, active }) {

function handleKeydown(event) {
if ((event.ctrlKey || event.metaKey) && event.key === 'f') {
searchState.setActive(true);
searchInputRef.current.focus();
searchInputRef.current.select();
event.preventDefault();
event.stopPropagation();
searchState.setActive(true);
setTimeout(() => {
searchInputRef.current?.focus();
searchInputRef.current?.select();
});
}
}

Expand Down

0 comments on commit 0f15a7f

Please sign in to comment.