Skip to content

[Bug]Chat Screen Layout Broken in New Project Creation Flow #142

@nogataka

Description

@nogataka

Issue: Chat Screen Layout Broken in New Project Creation Flow

Summary

The chat screen (SpecCreationChat) displays incorrectly on step 6 of the new project creation flow (after selecting "Create with Claude").

Steps to Reproduce

  1. Open project dropdown
  2. Click "New Project"
  3. Enter project name → Click "Next"
  4. Select project folder → Click "Select This Folder"
  5. Select "Create with Claude"
  6. Bug occurs: Chat screen layout is broken
Image Image Image Image Image Image

Root Cause Analysis

The Real Problem

The chat screen was rendered inside the ProjectSelector component, which is inside the header. This caused the fixed inset-0 container to be placed inside the dropdown DOM tree instead of at the document body level.

DOM Structure (before fix):

<body>
  <div id="root">
    <div class="min-h-screen">
      <header>
        <div class="relative">  <!-- ProjectSelector -->
          <button>Select Project</button>
          <div class="fixed inset-0">  <!-- Chat here! Wrong! -->
            <SpecCreationChat />
          </div>
        </div>
      </header>
      <main>Welcome to AutoCoder</main>  <!-- Still visible behind -->
    </div>
  </div>
</body>

Related Components

File Issue
ProjectSelector.tsx Renders NewProjectModal as a child
NewProjectModal.tsx Chat view using fixed inset-0 was constrained by parent DOM

Solution

Use React Portal (createPortal) to render the chat screen directly at document.body level, bypassing the DOM hierarchy.

Fix in NewProjectModal.tsx:

import { createPortal } from 'react-dom'

// Full-screen chat view - use portal to render at body level
if (step === 'chat') {
  return createPortal(
    <div className="fixed inset-0 z-50 bg-background flex flex-col">
      <SpecCreationChat ... />
    </div>,
    document.body
  )
}

DOM Structure (after fix):

<body>
  <div id="root">
    <div class="min-h-screen">
      <header>...</header>
      <main>...</main>
    </div>
  </div>
  <div class="fixed inset-0">  <!-- Chat here! Correct! -->
    <SpecCreationChat />
  </div>
</body>

Additional Fixes Applied

  1. SpecCreationChat.tsx: Changed h-fullh-screen for explicit viewport height
  2. SpecCreationChat.tsx: Added min-h-0 to messages area for proper flexbox scrolling

Labels

bug, ui, css, react-portal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions