refactor(chat): remove keyboard compatibility layer

This commit is contained in:
2026-07-16 14:36:33 +08:00
parent aec7cee9cf
commit 8b6bcab05c
9 changed files with 26 additions and 629 deletions
@@ -6,7 +6,6 @@ import { BrowserDetector } from "@/utils/browser-detect";
import { PlatformDetector } from "@/utils/platform-detect";
const CHAT_KEYBOARD_DEBUG_PARAM = "keyboard_debug";
const CHAT_INPUT_LIFT_VAR = "--chat-input-lift";
interface VirtualKeyboardLike extends EventTarget {
readonly boundingRect?: Pick<
@@ -41,7 +40,11 @@ export interface ChatKeyboardDebugSnapshot {
activeElement: string | null;
activeBottom: number | null;
activeFocused: boolean;
inputLift: string | null;
inputBarTop: number | null;
inputBarBottom: number | null;
appViewportHeight: string | null;
appVisibleHeight: string | null;
appVisibleOffsetTop: string | null;
viewportMeta: string | null;
platform: {
name: string;
@@ -151,6 +154,8 @@ function createChatKeyboardDebugSnapshot(
: null;
const platform = PlatformDetector.getPlatformInfo();
const browser = BrowserDetector.getBrowserInfo();
const rootStyle = document.documentElement.style;
const inputBarRect = containerRef.current?.getBoundingClientRect() ?? null;
return {
event,
@@ -176,8 +181,14 @@ function createChatKeyboardDebugSnapshot(
activeElement: activeElement?.tagName ?? null,
activeBottom: activeRect?.bottom ?? null,
activeFocused: activeElement !== document.body,
inputLift:
containerRef.current?.style.getPropertyValue(CHAT_INPUT_LIFT_VAR) || null,
inputBarTop: inputBarRect?.top ?? null,
inputBarBottom: inputBarRect?.bottom ?? null,
appViewportHeight:
rootStyle.getPropertyValue("--app-viewport-height") || null,
appVisibleHeight:
rootStyle.getPropertyValue("--app-visible-height") || null,
appVisibleOffsetTop:
rootStyle.getPropertyValue("--app-visible-offset-top") || null,
viewportMeta:
document.querySelector<HTMLMetaElement>('meta[name="viewport"]')
?.content ?? null,