fix: prevent empty bottom margin when focusing input on macOS desktop (#705)
* fix: prevent empty bottom margin when focusing input on macOS desktop Add `interactive-widget=resizes-visual` to the viewport meta tag so Chromium only resizes the visual viewport (not the layout viewport) when the virtual keyboard appears. This fixes the phantom margin that showed up on macOS Electron when the text input received focus. Closes chatboxai/chatbox#2023 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove mobile-only viewport params from desktop build Remove `height=device-height` and `viewport-fit=cover` from index.ejs (Electron desktop build) as they are mobile-specific and trigger Chromium's Virtual Keyboard API on macOS, causing an empty bottom margin when focusing the input field. index.html (Web/Mobile) keeps these params as they are needed there. Also reverts the `interactive-widget=resizes-visual` approach due to poor browser compatibility. Fixes chatboxai/chatbox#2023 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: strip mobile viewport params in desktop builds via Vite plugin Add `stripMobileViewport()` Vite plugin that removes `height=device-height` and `viewport-fit=cover` from the viewport meta tag during desktop (Electron) builds only. These mobile-specific params trigger Chromium's Virtual Keyboard API on macOS, causing an empty bottom margin when focusing input fields. Mobile and Web builds are unaffected — they keep the full viewport meta. Also reverts the previous index.ejs change (file is unused in current build). Fixes chatboxai/chatbox#2023 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: use regex to strip viewport params instead of hardcoded string Replace exact string match with regex that finds the viewport meta tag and selectively removes `height=device-height` and `viewport-fit=cover`. More robust against future changes to the viewport content. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: use placeholder injection for viewport meta content Replace regex-based stripping with a cleaner approach: - index.html uses `%VIEWPORT_CONTENT%` placeholder - `injectViewportContent()` Vite plugin replaces it at build time based on platform (desktop omits mobile-only viewport params) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 5010058a3b3c2cc813bb31f729e0c45f3ac5fc12)
Z
Zeng Xian committed
a85e80c24de7f2302616a07de4422a66f4a19f9a
Parent: a9d87cf