From c7a65939e45ada9a36b27ee6af381687af67cecc Mon Sep 17 00:00:00 2001 From: Maxwell <145994855+ping-maxwell@users.noreply.github.com> Date: Thu, 26 Feb 2026 18:10:06 -0800 Subject: [PATCH] fix: dont autofocus ghost chat input on mobile (#178) closes https://github.com/better-auth/better-hub/issues/139 --- apps/web/src/components/shared/global-chat-panel.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/shared/global-chat-panel.tsx b/apps/web/src/components/shared/global-chat-panel.tsx index d701101..f866a2b 100644 --- a/apps/web/src/components/shared/global-chat-panel.tsx +++ b/apps/web/src/components/shared/global-chat-panel.tsx @@ -6,6 +6,7 @@ import { X, Code2, ChevronRight, Ghost, Plus } from "lucide-react"; import { cn } from "@/lib/utils"; import { AIChat } from "@/components/shared/ai-chat"; import { useGlobalChat, type InlineContext } from "@/components/shared/global-chat-provider"; +import { useIsMobile } from "@/hooks/use-is-mobile"; import { searchRepoFiles, fetchFileContentForContext, @@ -177,6 +178,7 @@ export function GlobalChatPanel() { const prevContextKeyRef = useRef(null); const pathname = usePathname(); const searchParams = useSearchParams(); + const isMobile = useIsMobile(); // Defer rendering until after hydration — this panel starts hidden (translate-x-full) // and depends on client-only state (chat history, persisted context), so SSR is pointless @@ -697,7 +699,10 @@ export function GlobalChatPanel() { hashMentionPrFiles={ mentionableFiles } - autoFocus={isActive} + autoFocus={ + isActive && + !isMobile + } historyItems={ghostHistory} onLoadHistory={ handleLoadHistory