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. β
|
|
|
|
| 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
|
| 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">
|