Commit 824e131
authored
🤖 Fix chat controls wrapping on constrained viewports (#411)
## Problem
Chat controls under ChatInput (ModelSelector, ThinkingSlider,
Context1MCheckbox, mode toggles) don't adapt properly to constrained
viewports, causing horizontal overflow or awkward wrapping.
## Root Cause
The individual control components have hardcoded left margins
(`ThinkingSlider` has `ml-5`, `Context1MCheckbox` has `ml-2`) that are
part of their content size. These margins prevent proper flex wrapping
behavior.
## Solution
Changed from a wrapping approach to **progressive hiding** with
**overflow scrolling** as a fallback:
### Container
- `overflow-x-auto` - allows horizontal scroll as last resort
- `overflow-y-hidden` - prevents vertical scroll
### Progressive Hiding (using container queries)
Controls are hidden based on viewport width, from least to most
critical:
1. **Mode toggles** (`max-@[700px]:hidden`) - hide below 700px
(existing)
2. **ThinkingSlider** (`max-@[600px]:hidden`) - hide below 600px (new)
3. **Context1M** (`max-@[500px]:hidden`) - hide below 500px (new)
4. **ModelSelector** - always visible (most critical)
## Benefits
- ✅ Works WITH existing component layouts (respects hardcoded margins)
- ✅ Gracefully removes less critical controls on narrow viewports
- ✅ Horizontal scroll available if viewport is extremely constrained
- ✅ No awkward wrapping to multiple lines
- ✅ Each component has `data-component` attribute for easy debugging
## Changes
- Modified controls container in `ChatInput.tsx`
- Replaced `flex-wrap` with `overflow-x-auto`
- Added container query breakpoints for progressive hiding
- Removed `min-w-0` flex hacks (no longer needed)
_Generated with `cmux`_1 parent c596556 commit 824e131
File tree
4 files changed
+52
-41
lines changed- src/components
- tests/e2e/utils
4 files changed
+52
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
746 | 747 | | |
747 | 748 | | |
748 | 749 | | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
780 | 792 | | |
781 | 793 | | |
782 | 794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
| |||
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 129 | + | |
134 | 130 | | |
135 | 131 | | |
136 | 132 | | |
| |||
148 | 144 | | |
149 | 145 | | |
150 | 146 | | |
| 147 | + | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
| |||
165 | 162 | | |
166 | 163 | | |
167 | 164 | | |
168 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
0 commit comments