diff --git a/app/src/DashboardPage.js b/app/src/DashboardPage.js index d23e9afb..b8acc7a5 100644 --- a/app/src/DashboardPage.js +++ b/app/src/DashboardPage.js @@ -8,6 +8,7 @@ import { useTitle } from "./components/Common"; import React, {useContext, useState} from "react"; +import {useHotkeys} from "react-hotkeys-hook"; import {Media, SettingsContext, StatusContext} from "./contexts/contexts"; import {DownloadMenu} from "./components/Download"; import { @@ -308,6 +309,14 @@ function DashboardRecentFiles() { export function DashboardPage() { const navigate = useNavigate(); + const searchInputRef = React.useRef(); + + useHotkeys('f', (e) => { + e.preventDefault(); + if (searchInputRef.current) { + searchInputRef.current.focus(); + } + }, {enableOnFormTags: false}); // The search the user submitted. const {searchStr, setSearchStr, activeTags, isEmpty, anyTag} = useSearch(); @@ -384,6 +393,7 @@ export function DashboardPage() { handleResultSelect={handleResultSelect} resultRenderer={resultRenderer} loading={loading} + inputRef={searchInputRef} {...props} />; }; diff --git a/app/src/components/Archive.js b/app/src/components/Archive.js index fa82a7c7..86a51a6e 100644 --- a/app/src/components/Archive.js +++ b/app/src/components/Archive.js @@ -1,4 +1,5 @@ import React, {useContext, useState} from "react"; +import {useHotkeys} from "react-hotkeys-hook"; import { CardContent, CardDescription, @@ -453,6 +454,14 @@ export function DomainsPage() { const [domains] = useDomains(); const [searchStr, setSearchStr] = useOneQuery('domain'); + const searchInputRef = React.useRef(); + + useHotkeys('f', (e) => { + e.preventDefault(); + if (searchInputRef.current) { + searchInputRef.current.focus(); + } + }, {enableOnFormTags: false}); // Header section matching ChannelsPage pattern const header =