Nanny7 Claude Sonnet 4.5 commited on
Commit
d9a7603
Β·
1 Parent(s): eec399c

fix: prevent chat window left overflow on mobile (Issue 4)

Browse files

- Update AIChatPanel positioning: left-3 right-3 on mobile
- Use sm: breakpoint for desktop left-auto right-4
- Add max-h-[80vh] and overflow-y-auto for height safety
- Update MOBILE-FIXES.md with Issue 4 documentation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

MOBILE-FIXES.md CHANGED
@@ -62,6 +62,39 @@ className="flex gap-2 items-end p-3 md:p-4 ... text-sm md:text-base"
62
 
63
  ---
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  ## πŸš€ Deployment Status
66
 
67
  ### **GitHub:** βœ… Pushed to `001-ai-assistant` branch
@@ -178,7 +211,8 @@ https://huggingface.co/spaces/ammaraak/todo-app
178
  3. βœ… Input field mobile-friendly
179
  4. βœ… All touch targets appropriate size
180
  5. βœ… Height calculations prevent viewport overflow
181
- 6. βœ… Pushed to GitHub for Vercel deployment
 
182
 
183
  **Next:** Wait 5 minutes for Vercel deployment, then test on mobile!
184
 
 
62
 
63
  ---
64
 
65
+ ### **4. ISSUE: Chat Window Left Overflow (Mobile)** πŸ› 
66
+ **Problem:** Chat window opens β†’ goes out of screen on left side (mobile)
67
+ **Reason:** Fixed width without proper left boundary constraint
68
+
69
+ **Fix Applied:**
70
+ ```tsx
71
+ // Container positioning
72
+ className="
73
+ fixed
74
+ bottom-20
75
+ left-3 right-3 // Full safe margins (mobile)
76
+ sm:left-auto sm:right-4 // Desktop right-only
77
+ max-w-md
78
+ w-auto
79
+ max-h-[80vh]
80
+ overflow-y-auto
81
+ "
82
+ ```
83
+
84
+ **Mobile:** `left-3 right-3` (prevents left overflow, centered within screen)
85
+ **Desktop:** `sm:left-auto sm:right-4` (floating on right)
86
+
87
+ **Safety Rules:**
88
+ - βœ… Fixed positioning with `left` + `right` constraints
89
+ - βœ… `max-h-[80vh]` + `overflow-y-auto` prevents vertical overflow
90
+ - βœ… `w-auto` + `max-w-md` for flexible width
91
+ - βœ… No transform/overflow-hidden on parent containers
92
+ - βœ… Floating icon alignment: `right-16 bottom-16 z-9999`
93
+
94
+ **Result:** Chat window stays fully inside viewport on all devices
95
+
96
+ ---
97
+
98
  ## πŸš€ Deployment Status
99
 
100
  ### **GitHub:** βœ… Pushed to `001-ai-assistant` branch
 
211
  3. βœ… Input field mobile-friendly
212
  4. βœ… All touch targets appropriate size
213
  5. βœ… Height calculations prevent viewport overflow
214
+ 6. βœ… **NEW: Chat window left overflow prevented (Issue 4)**
215
+ 7. βœ… Pushed to GitHub for Vercel deployment
216
 
217
  **Next:** Wait 5 minutes for Vercel deployment, then test on mobile!
218
 
frontend/src/components/ai-assistant/AIChatPanel.tsx CHANGED
@@ -69,7 +69,7 @@ export function AIChatPanel({ isOpen, onClose, onActionExecuted }: AIChatPanelPr
69
  }}
70
  exit={{ opacity: 0, scale: 0.95, y: 20 }}
71
  transition={{ duration: 0.2 }}
72
- className="fixed bottom-20 right-4 left-4 md:left-auto md:right-6 w-auto md:w-full md:max-w-md h-[calc(100vh-80px)] md:h-auto bg-white dark:bg-gray-900 rounded-2xl shadow-2xl dark:shadow-[0_0_40px_rgba(6,182,212,0.3)] border border-gray-200 dark:border-cyan-500/30 flex flex-col overflow-hidden z-50"
73
  >
74
  {/* Header */}
75
  <div className="flex items-center justify-between px-6 py-4 bg-gradient-to-r from-cyan-500 to-purple-600 dark:from-cyan-600 dark:to-purple-700">
 
69
  }}
70
  exit={{ opacity: 0, scale: 0.95, y: 20 }}
71
  transition={{ duration: 0.2 }}
72
+ className="fixed bottom-20 left-3 right-3 sm:left-auto sm:right-4 max-w-md w-auto max-h-[80vh] overflow-y-auto bg-white dark:bg-gray-900 rounded-2xl shadow-2xl dark:shadow-[0_0_40px_rgba(6,182,212,0.3)] border border-gray-200 dark:border-cyan-500/30 flex flex-col z-50"
73
  >
74
  {/* Header */}
75
  <div className="flex items-center justify-between px-6 py-4 bg-gradient-to-r from-cyan-500 to-purple-600 dark:from-cyan-600 dark:to-purple-700">