Insights:Responsive and Mobile Troubleshooting: From Symptoms to Root Cause
Issue 1: Horizontal Scrolling
Common root causes:
- Container has a fixed
widthormin-width. - Long URLs or words do not wrap.
- Absolutely positioned elements extend beyond the viewport.
- Negative margin values.
- Wide tables/images lack responsive sizing.
Troubleshooting:
[...document.querySelectorAll('*')]
.filter(el => el.scrollWidth > document.documentElement.clientWidth)
.forEach(el => console.log(el.tagName, el.className, el.scrollWidth));
Fix: Switch to fluid widths, add overflow-wrap: anywhere, enable horizontal scrolling on tables, and set images to max-width: 100%.
Issue 2: Content Being Clipped
Common root causes:
- Fixed height combined with
overflow: hidden. - Absolutely positioned elements clipped by parent containers.
- Key content hidden on mobile devices.
- Dialog height exceeds the screen.
Fix: Remove fixed heights, use min-height instead, check overflow properties, and make dialogs scrollable if needed.
Issue 3: Unclickable Buttons
Common root causes:
- Touch target smaller than 44px.
- Transparent overlay blocking clicks.
- Interaction depends on hover state.
- Fixed bottom bar covering the button.
- Overlapping elements.
Fix: enlarge click area, check stacking order, use :active, keep a safe margin.
Symptom 4: Slow Loading
Common root causes:
- Large hero images on first screen.
- Multiple font sets.
- Synchronous third-party scripts.
- No caching/CDN.
- Slow APIs.
Fix: srcset, font subsetting, deferred scripts, caching, API optimization.
Symptom 5: Layout Shift
Common root causes:
- Images/videos without reserved dimensions.
- Ads injected after initial render.
- Font loading replacements.
- Dynamically inserted content at the top.
Fix: aspect-ratio, reserve ad slots, font-display:swap, avoid inserting at the top.
Symptom 6: Form Issues
Common root causes:
- Input font size below 16px triggers iOS zoom.
- Incorrect input type.
- Validation hints obscured by keyboard.
- Duplicate submissions.
Fix: 16px or above, correct type, move hints upward, prevent duplicate submit.
Troubleshooting Order
- Reproduce and record device model and viewport width.
- Use DevTools to locate elements.
- Inspect CSS width/height, overflow, and positioning.
- Check images/fonts/scripts.
- Change only one variable at a time, then retest.
- Regression test across multiple devices.
Record Table
| Symptom | Width | Element | Root Cause | Fix | Retest |
|---|---|---|---|---|---|
| Horizontal scroll | 375 | .hero | Fixed 1200px | Change max-width | Pass |
What Not to Do
- Masking the issue with global
overflow-x: hidden. - Solving layout problems via scaling.
- Testing on just one phone.
- Making consecutive changes without recording them.
Boundaries
Troubleshooting addresses specific layout and performance issues; it does not substitute for a design system. When similar issues recur, you should extract reusable components and specifications.
Related Reading: