From 9b270dabde8cd3ece5cfd7db29c74a73be2e7f66 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 14 Apr 2026 18:43:31 -0400 Subject: [PATCH] Add `cmd+k` shortcut hint to search input (#12045) * Add cmd+k shortcut hint to search input fix: Shrink on mobile * fix shrinking, hide on mobile --- app/components/InputSearchPage.tsx | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/app/components/InputSearchPage.tsx b/app/components/InputSearchPage.tsx index 3c8b636e96..635ad4ddc5 100644 --- a/app/components/InputSearchPage.tsx +++ b/app/components/InputSearchPage.tsx @@ -4,7 +4,13 @@ import * as React from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; import styled, { useTheme } from "styled-components"; -import { isModKey } from "@shared/utils/keyboard"; +import breakpoint from "styled-components-breakpoint"; +import { s } from "@shared/styles"; +import { + isModKey, + metaDisplay, + shortcutSeparator, +} from "@shared/utils/keyboard"; import useBoolean from "~/hooks/useBoolean"; import useKeyDown from "~/hooks/useKeyDown"; import { searchPath } from "~/utils/routeHelpers"; @@ -97,16 +103,36 @@ function InputSearchPage({ onBlur={setUnfocused} margin={0} labelHidden - /> + > + + {metaDisplay} + {shortcutSeparator}K + + ); } const InputMaxWidth = styled(Input)` - max-width: 30vw; + max-width: min(calc(30vw + 20px), 100%); ${Outline} { border-radius: 16px; } `; +const Shortcut = styled.span<{ $visible: boolean }>` + display: none; + flex-shrink: 0; + font-size: 13px; + color: ${s("textTertiary")}; + padding-right: 10px; + pointer-events: none; + opacity: ${(props) => (props.$visible ? 1 : 0)}; + transition: opacity 100ms ease-in-out; + + ${breakpoint("tablet")` + display: inline; + `}; +`; + export default observer(InputSearchPage);