Skip to content

Commit

Permalink
fix: update search hotkey, add better placeholder, add body tag
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-cratebind committed Jan 4, 2022
1 parent 5fcf517 commit 7e60cd5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/theme/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const Search = ({ directories }) => {
const input = useRef(null);

useEffect(() => {
const inputs = ['input', 'select', 'button', 'textarea'];
const inputs = ['body', 'input', 'select', 'button', 'textarea'];

const down = e => {
if (
document.activeElement &&
inputs.includes(document.activeElement.tagName.toLowerCase())
) {
if (e.key === '/') {
if (e.metaKey && e.key === 'k') {
e.preventDefault();
input.current.focus();
} else if (e.key === 'Escape') {
Expand Down Expand Up @@ -78,7 +78,7 @@ const Search = ({ directories }) => {
className="appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-full"
id={SEARCH_ID}
type="search"
placeholder='Search ("/" to focus)'
placeholder="Search (⌘ + k)"
ref={input}
/>
</div>
Expand Down

0 comments on commit 7e60cd5

Please sign in to comment.