Skip to content

fix: prevent chat page layout shift hiding top navbar on Windows#473

Merged
jamiepine merged 1 commit intospacedriveapp:mainfrom
TheDarkSkyXD:fix/windows-chat-layout-issues
Mar 24, 2026
Merged

fix: prevent chat page layout shift hiding top navbar on Windows#473
jamiepine merged 1 commit intospacedriveapp:mainfrom
TheDarkSkyXD:fix/windows-chat-layout-issues

Conversation

@TheDarkSkyXD
Copy link
Contributor

Summary

  • Scope zoom to macOS only: The zoom: 1.1 on <body> was meant to compensate for WKWebView's smaller rendering scale, but was applied on all Tauri platforms. On Windows (WebView2/Chromium), this made content 10% taller than the viewport, causing overflow that hid the top navbar or clipped the chat input. Now only applied when running on macOS.
  • Replace scrollIntoView with targeted scrollTo: scrollIntoView() propagates scroll to all scrollable ancestors — including elements with overflow: hidden — which shifted the entire root layout upward, hiding the top navbar. Using scrollTo() directly on the messages container keeps scrolling contained.
  • Prevent scroll on textarea focus: textarea.focus() in the floating chat input triggered the browser's scroll-to-focus behavior on ancestor containers. Added preventScroll: true.
  • Add overflow-hidden to root layout: Safety net to prevent any future scroll propagation from shifting the layout.

Test plan

  • Open the desktop app on Windows — verify the top navbar (agent name) stays visible on the Chat tab
  • Verify the chat input bar is visible at the bottom of the Chat page
  • Send messages and confirm auto-scroll works correctly within the messages container
  • Verify no layout shift occurs when navigating between agent tabs (Overview → Chat → Channels, etc.)
  • Open the desktop app on macOS — verify the zoom: 1.1 still applies and the UI looks correct

🤖 Generated with Claude Code

Three issues caused the top navbar to disappear and the chat input to
get clipped when navigating to the Chat tab on Windows (Tauri):

1. The `zoom: 1.1` on body was applied unconditionally in Tauri but is
   only needed for WKWebView (macOS). On Windows (WebView2), it made
   content 10% taller than the viewport, causing overflow and scroll
   shifts. Now only applied on macOS.

2. `scrollIntoView()` in WebChatPanel propagated scroll to ancestor
   `overflow-hidden` containers, shifting the entire layout upward.
   Replaced with targeted `scrollTo()` on the messages container.

3. `textarea.focus()` in FloatingChatInput triggered browser
   scroll-to-focus behavior on ancestor containers. Added
   `preventScroll: true` to prevent this.

Also added `overflow-hidden` on the root layout div as a safety net
against any future scroll propagation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a19b1bdf-feba-45ea-a22f-316bd186daf9

📥 Commits

Reviewing files that changed from the base of the PR and between 6f81f39 and 573a6dc.

📒 Files selected for processing (3)
  • interface/src/components/WebChatPanel.tsx
  • interface/src/main.tsx
  • interface/src/router.tsx

Walkthrough

Updates focus behavior and auto-scrolling mechanics in the chat panel by replacing sentinel-element-based scrolling with direct container scrolling. Applies platform-specific zoom styling for macOS on Tauri startup. Adds overflow containment to the root layout container.

Changes

Cohort / File(s) Summary
Chat Panel Auto-scroll Refactor
interface/src/components/WebChatPanel.tsx
Replaced sentinel ref (messagesEndRef) with container ref (scrollRef) for direct scrollTo() calls. Updated FloatingChatInput focus to use preventScroll: true option. Removed trailing sentinel div element.
Tauri Platform-specific Styling
interface/src/main.tsx
Guarded document.body.style.zoom = "1.1" assignment behind macOS detection using navigator.userAgentData.platform with fallback to navigator.platform.
Root Layout Styling
interface/src/router.tsx
Added overflow-hidden class to top-level layout container wrapping TopBar, ConnectionBanner, Sidebar, and main Outlet.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • #336: Modifies message list container styling and layout in WebChatPanel.tsx, affecting the same scroll and overflow behavior area.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main problem: preventing layout shift that hides the navbar on Windows. It accurately summarizes the primary fix across the changeset.
Description check ✅ Passed The description clearly relates to the changeset, detailing the specific fixes made to address the layout shift issue on Windows and the technical approach taken.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jamiepine jamiepine merged commit 86d6b3b into spacedriveapp:main Mar 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants