Skip to main content

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:

  1. Check Script Loading:

    // Verify scripts are loaded
    if (typeof XBCompare === 'undefined') {
    console.error('XB Compare scripts not loaded');
    }
  2. Mobile-Specific CSS:

    @media (max-width: 768px) {
    .xb-compare-table {
    display: block !important;
    width: 100%;
    }
    }
  3. 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:

  1. Increase Touch Target Size:

    .xb-compare-button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px;
    }
  2. Enable Touch Events:

    .xb-compare-table {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    }
  3. 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:

  1. 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;
    }
    }
  2. Image Optimization:

    .xb-compare-image {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    }
  3. 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:

  1. Image Optimization:

    .xb-compare-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    }
  2. 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));
  3. 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:

  1. 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;
    }
  2. 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:

  1. Fix Viewport Height:

    .xb-compare-wrapper {
    height: 100vh;
    height: -webkit-fill-available;
    }
  2. 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:

  1. Address Bar Handling:

    // Handle address bar changes
    window.addEventListener('resize', () => {
    // Recalculate layout when address bar changes
    setTimeout(() => {
    window.scrollTo(0, 0);
    }, 100);
    });
  2. Android Performance:

    .xb-compare-table {
    will-change: transform;
    transform: translateZ(0);
    }

Testing and Debugging

Mobile Testing Tools

  1. Browser DevTools:

    • Chrome DevTools device simulation
    • Firefox responsive design mode
    • Safari Web Inspector
  2. Real Device Testing:

    • Test on actual iOS and Android devices
    • Use different screen sizes
    • Test with different network conditions
  3. Performance Monitoring:

    • Use browser performance tools
    • Monitor memory usage
    • Check network requests

Debug Steps

  1. Check Console Errors:

    // Add error logging
    window.addEventListener('error', (e) => {
    console.error('Mobile error:', e.error);
    });
  2. Network Debugging:

    • Check if all resources are loading
    • Monitor network requests
    • Test with slow connections
  3. 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
Pro Tip

Regularly test your comparison feature on real mobile devices to catch issues early and ensure the best possible user experience.