Fix font-size/padding not applying in VS Code (#1261) (#1595)

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:
Sin991114
2026-06-23 11:32:30 +03:00
committed by GitHub
parent eab8862268
commit 6c1e41c5f9
+3 -2
View File
@@ -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;