Skip to content

fix(chat): chat-sidenav host must be position:fixed so it doesn't push siblings#257

Merged
blove merged 1 commit into
mainfrom
fix/chat-sidenav-host-out-of-flow
May 12, 2026
Merged

fix(chat): chat-sidenav host must be position:fixed so it doesn't push siblings#257
blove merged 1 commit into
mainfrom
fix/chat-sidenav-host-out-of-flow

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 12, 2026

Summary

The new <chat-sidenav> from #253 sets :host { display: block; height: 100% } and per-mode width on the inner .chat-sidenav (not the host). The host then stretches to the parent's full width (1800px on a 1080p viewport) and participates in document flow, pushing its sibling .demo-shell__main (router-outlet + chat) below the viewport.

The demo shell uses padding-left: 280px on .demo-shell__main--push to reserve space — a pattern that only works if the sidenav is positioned out of flow.

Fix: put the host into position: fixed; top: 0; left: 0; bottom: 0 in expanded and collapsed modes, and move the per-mode width from the inner .chat-sidenav onto the host (inner stays 100% wide). Drawer mode is unaffected (its inner .chat-sidenav is already position: fixed).

Browser-verified at localhost:4201/embed post-fix:

  • chat-sidenav host: position: fixed, width 280px, left=0, top=0 ✓
  • embed-mode: x=280, y=0, w=1520 (was y=930 → off-screen) ✓
  • main: y=0 with padding-left: 280px

Test plan

  • npx vitest run chat-sidenav — existing 10 tests pass
  • npx nx lint chat — clean
  • npx nx build examples-chat-angular — succeeds
  • Open http://localhost:4201/embed — chat content visible to the right of the 280px sidenav, not pushed off-screen.

🤖 Generated with Claude Code

…psed modes

The host element was display:block + position:static, so it stretched to
the parent's full width and pushed sibling content out of flow. In the
demo shell — which uses padding-left:280px on .demo-shell__main to
reserve space — this dropped the chat below the viewport.

Make the host position:fixed (with the right width per mode) in expanded
and collapsed modes, so it sits beside main content without displacing
it. Drawer mode is unaffected (the inner .chat-sidenav is already fixed).

Move the per-mode width from the inner .chat-sidenav to the host so the
fixed host has the correct size; the inner aside stays at 100%.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 12, 2026 4:39pm

Request Review

@blove blove merged commit 6ae5dc0 into main May 12, 2026
14 checks passed
@blove blove deleted the fix/chat-sidenav-host-out-of-flow branch May 12, 2026 16:44
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.

1 participant