diff --git a/src/Components/Home.js b/src/Components/Home.js index c3aa9d856b9..6ff7e58d80d 100644 --- a/src/Components/Home.js +++ b/src/Components/Home.js @@ -5,6 +5,15 @@ import Navbar from './Navbar' import GetIcons from './Icons/GetIcons' import { useTheme } from '../ThemeContext' +document.addEventListener('keydown', (e) => { + e = e || window.event + const searchbox = document.getElementById('search-button') + if (e.key === 'k' && e.ctrlKey) { + searchbox.click() + e.preventDefault() + } +}) + function Home() { const darkTheme = useTheme() @@ -13,7 +22,7 @@ function Home() {
+ { + e = e || window.event + const searchbox = document.getElementById('search-input') + if (e.key === 'k' && e.ctrlKey) { + searchbox.focus() + e.preventDefault() + } +}) + const Searchbar = ({ searchHandler, searchTerm }) => { const darkTheme = useTheme()