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;