The VS Code webview was misdetected as a mobile device when the panel was narrow on touch-capable machines, because device detection only exempted the Electron shell. That added the `mobile-pointer` class, letting mobile.css override the typography vars with `!important`, which beats the inline styles from applyTypography/applyPadding — so font-size and padding settings had no effect. Treat the VS Code runtime like the desktop shell, as Electron already is.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { isDesktopShell } from '@/lib/desktop';
|
||||
import { isDesktopShell, isVSCodeRuntime } from '@/lib/desktop';
|
||||
|
||||
export type DeviceType = 'desktop' | 'mobile' | 'tablet';
|
||||
|
||||
@@ -108,7 +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;
|
||||
const isDesktopShellRuntime = isDesktopShell();
|
||||
// VS Code is a desktop surface — don't misdetect a narrow panel as mobile (#1261)
|
||||
const isDesktopShellRuntime = isDesktopShell() || isVSCodeRuntime();
|
||||
const { isExplicitTablet } = getNavigatorDeviceHints(maxTouchPoints);
|
||||
|
||||
const hasTouchInput = prefersCoarsePointer || noHover || maxTouchPoints > 0;
|
||||
|
||||
Reference in New Issue
Block a user