From 5a91c0841387a46fcb6b77eb5a7d44b07b20c2bc Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sat, 11 Jul 2026 09:40:35 +0300 Subject: [PATCH] fix: treat embedded session chat as desktop surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents narrow embedded session chat panels from being misdetected as mobile Uses the ocPanel=session-chat query parameter to पहचान desktop-like layout Keeps device detection aligned with other desktop shell runtimes --- packages/ui/src/lib/device.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/lib/device.ts b/packages/ui/src/lib/device.ts index 7417500b..dc58daa2 100644 --- a/packages/ui/src/lib/device.ts +++ b/packages/ui/src/lib/device.ts @@ -35,6 +35,11 @@ const DEFAULT_DEVICE_INFO: DeviceInfo = { hasTouchOnlyPointer: false, }; +const isEmbeddedSessionChat = (): boolean => { + if (typeof window === 'undefined') return false; + return new URLSearchParams(window.location.search).get('ocPanel') === 'session-chat'; +}; + const getNavigatorDeviceHints = (maxTouchPoints: number) => { if (typeof navigator === 'undefined') { return { isExplicitTablet: false }; @@ -103,8 +108,8 @@ export function getDeviceInfo(): DeviceInfo { const prefersCoarsePointer = pointerQuery?.matches ?? false; const noHover = hoverQuery?.matches ?? false; const maxTouchPoints = typeof navigator !== 'undefined' ? navigator.maxTouchPoints ?? 0 : 0; - // VS Code is a desktop surface — don't misdetect a narrow panel as mobile (#1261) - const isDesktopShellRuntime = isDesktopShell() || isVSCodeRuntime(); + // Desktop panels are desktop surfaces even when their viewport is narrow. + const isDesktopShellRuntime = isDesktopShell() || isVSCodeRuntime() || isEmbeddedSessionChat(); const { isExplicitTablet } = getNavigatorDeviceHints(maxTouchPoints); const hasTouchInput = prefersCoarsePointer || noHover || maxTouchPoints > 0;