Mobile Comparison Issues
Troubleshoot common mobile comparison issues and optimize your mobile experience.
Common Mobile Issues
Comparison Table Not Displaying
Symptoms: Comparison table doesn't appear on mobile devices
Causes:
- Mobile scripts not properly loaded
- CSS conflicts with theme styles
- JavaScript errors on mobile browsers
- Network connectivity issues
Solutions:
-
Check Script Loading:
// Verify scripts are loaded
if (typeof XBCompare === 'undefined') {
console.error('XB Compare scripts not loaded');
} -
Mobile-Specific CSS:
@media (max-width: 768px) {
.xb-compare-table {
display: block !important;
width: 100%;
}
} -
Clear Mobile Cache:
- Clear browser cache on mobile device
- Hard refresh the page (Ctrl+F5 or Cmd+Shift+R)
- Test in incognito/private browsing mode
Touch Interaction Problems
Symptoms: Buttons don't respond to touch, scrolling issues
Causes:
- Touch targets too small
- CSS preventing touch events
- JavaScript touch event conflicts
- Browser compatibility issues
Solutions:
-
Increase Touch Target Size:
.xb-compare-button {
min-height: 44px;
min-width: 44px;
padding: 12px;
} -
Enable Touch Events:
.xb-compare-table {
touch-action: manipulation;
-webkit-touch-callout: none;
} -
Fix Touch Event Handling:
// Ensure touch events work
document.addEventListener('touchstart', function(e) {
e.preventDefault();
}, { passive: false });
Layout and Display Issues
Symptoms: Table layout broken, text cut off, images not displaying
Causes:
- Responsive CSS not working
- Fixed widths causing overflow
- Image optimization issues
- Font size problems
Solutions:
-
Responsive Table Layout:
@media (max-width: 768px) {
.xb-compare-table {
font-size: 14px;
overflow-x: auto;
}
.xb-compare-table th,
.xb-compare-table td {
padding: 8px 4px;
white-space: nowrap;
}
} -
Image Optimization:
.xb-compare-image {
max-width: 100%;
height: auto;
object-fit: cover;
} -
Text Sizing:
@media (max-width: 768px) {
.xb-compare-text {
font-size: 14px;
line-height: 1.4;
}
}
Performance Issues
Slow Loading on Mobile
Symptoms: Comparison table takes too long to load
Causes:
- Large images not optimized
- Too many fields being loaded
- Network latency
- JavaScript execution time
Solutions:
-
Image Optimization:
.xb-compare-image {
width: 150px;
height: 150px;
object-fit: cover;
} -
Lazy Loading:
// Implement lazy loading for images
const images = document.querySelectorAll('.xb-compare-image');
const imageObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const img = entry.target;
img.src = img.dataset.src;
imageObserver.unobserve(img);
}
});
});
images.forEach(img => imageObserver.observe(img)); -
Reduce Field Count:
- Show only essential fields on mobile
- Load additional fields on demand
- Use progressive enhancement
Memory Issues
Symptoms: App crashes or becomes unresponsive
Causes:
- Too many products being compared
- Large data objects in memory
- Memory leaks in JavaScript
- Browser limitations
Solutions:
-
Limit Product Count:
const MAX_MOBILE_COMPARISONS = 3;
if (window.innerWidth <= 768 && selectedProducts.length > MAX_MOBILE_COMPARISONS) {
showAlert('Maximum 3 products can be compared on mobile');
return;
} -
Memory Management:
// Clean up event listeners
function cleanup() {
document.removeEventListener('touchstart', handleTouch);
// Remove other event listeners
}
// Call cleanup when component unmounts
window.addEventListener('beforeunload', cleanup);
Browser-Specific Issues
iOS Safari Issues
Common Problems:
- Viewport height issues
- Touch event handling
- CSS flexbox problems
- WebKit-specific bugs
Solutions:
-
Fix Viewport Height:
.xb-compare-wrapper {
height: 100vh;
height: -webkit-fill-available;
} -
iOS Touch Fixes:
.xb-compare-button {
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
}
Android Chrome Issues
Common Problems:
- Address bar hiding/showing
- Touch scrolling
- Performance on older devices
- Memory management
Solutions:
-
Address Bar Handling:
// Handle address bar changes
window.addEventListener('resize', () => {
// Recalculate layout when address bar changes
setTimeout(() => {
window.scrollTo(0, 0);
}, 100);
}); -
Android Performance:
.xb-compare-table {
will-change: transform;
transform: translateZ(0);
}
Testing and Debugging
Mobile Testing Tools
-
Browser DevTools:
- Chrome DevTools device simulation
- Firefox responsive design mode
- Safari Web Inspector
-
Real Device Testing:
- Test on actual iOS and Android devices
- Use different screen sizes
- Test with different network conditions
-
Performance Monitoring:
- Use browser performance tools
- Monitor memory usage
- Check network requests
Debug Steps
-
Check Console Errors:
// Add error logging
window.addEventListener('error', (e) => {
console.error('Mobile error:', e.error);
}); -
Network Debugging:
- Check if all resources are loading
- Monitor network requests
- Test with slow connections
-
Layout Debugging:
- Use browser dev tools to inspect elements
- Check CSS media queries
- Verify responsive breakpoints
Best Practices
Mobile-First Design
- Design for mobile first, then desktop
- Use progressive enhancement
- Test on real devices regularly
- Optimize for touch interactions
Performance Optimization
- Minimize JavaScript execution
- Optimize images for mobile
- Use efficient CSS selectors
- Implement proper caching
User Experience
- Provide clear touch targets
- Use appropriate gestures
- Handle orientation changes
- Provide offline functionality
Getting Help
Support Resources
- Check the app's support documentation
- Contact support with specific error details
- Provide device and browser information
- Include screenshots or screen recordings
Reporting Issues
When reporting mobile issues, include:
- Device model and OS version
- Browser name and version
- Steps to reproduce the issue
- Screenshots or videos
- Console error messages
Regularly test your comparison feature on real mobile devices to catch issues early and ensure the best possible user experience.