Quality, Performance, Accessibility, and Shipping Intermediate 10 min read

Cross-Browser Testing and Shopify Quirks

Learn to test Shopify themes across browsers and devices, handle browser-specific issues, and navigate Shopify's platform quirks.

Themes must work across browsers, devices, and Shopify’s unique environment. This lesson covers testing strategies and common quirks you’ll encounter.

Browser Support Matrix

Priority Browsers

BrowserPriorityNotes
Chrome (Desktop/Mobile)HighLargest market share
Safari (Desktop/iOS)HighiPhone/Mac users
FirefoxMediumDeveloper audience
EdgeMediumWindows default
Samsung InternetMediumPopular on Android

Testing Environments

## Recommended Test Environments
Desktop:
- Chrome (Windows/Mac)
- Safari (Mac)
- Firefox (Windows/Mac)
- Edge (Windows)
Mobile:
- Safari (iOS, multiple iPhone sizes)
- Chrome (Android)
- Samsung Internet (Android)
Tablets:
- Safari (iPad)
- Chrome (Android tablet)

Testing Checklist

Visual Testing

## Visual Tests
- [ ] Layout renders correctly
- [ ] Images display at correct sizes
- [ ] Fonts load and display
- [ ] Colors match design
- [ ] Hover states work
- [ ] Focus states visible
- [ ] Animations play smoothly
- [ ] No horizontal overflow
- [ ] Sticky elements work

Functional Testing

## Functional Tests
- [ ] Navigation menus work
- [ ] Mobile menu opens/closes
- [ ] Dropdowns function
- [ ] Forms submit correctly
- [ ] Cart updates
- [ ] Variant selection works
- [ ] Search functions
- [ ] Filtering/sorting works
- [ ] Modal/drawer interactions
- [ ] Sliders/carousels work

Common Browser Issues

Safari Issues

/* Flexbox gap not supported in older Safari */
/* Use margin fallback */
.flex-container {
display: flex;
gap: 1rem; /* Modern browsers */
}
@supports not (gap: 1rem) {
.flex-container > * + * {
margin-left: 1rem;
}
}
/* Sticky positioning in Safari */
.sticky-header {
position: -webkit-sticky; /* Safari */
position: sticky;
top: 0;
}
/* 100vh issue on iOS Safari */
.full-height {
height: 100vh;
height: 100dvh; /* Dynamic viewport height */
}

Safari Form Styling

/* Reset Safari form styles */
input,
button,
select,
textarea {
-webkit-appearance: none;
appearance: none;
border-radius: 0;
}
/* Fix select dropdown arrow */
select {
background-image: url('data:image/svg+xml,...');
background-repeat: no-repeat;
background-position: right 0.5rem center;
}

iOS Safari Specifics

/* Prevent zoom on input focus */
@media screen and (max-width: 768px) {
input,
select,
textarea {
font-size: 16px; /* Prevents zoom */
}
}
/* Safe area insets for notch */
.footer {
padding-bottom: env(safe-area-inset-bottom);
}
/* Momentum scrolling */
.scroll-container {
-webkit-overflow-scrolling: touch;
overflow-y: auto;
}

Firefox Issues

/* Scrollbar styling (Firefox) */
* {
scrollbar-width: thin;
scrollbar-color: var(--color-primary) var(--color-background);
}
/* Number input spinner */
input[type='number'] {
-moz-appearance: textfield;
}

Edge/IE Legacy

{# Detect and warn legacy browsers #}
<!--[if IE]>
<div class="browser-warning">
Your browser is not supported. Please upgrade.
</div>
<![endif]-->

Shopify-Specific Quirks

Preview Bar Offset

/* Account for Shopify preview bar */
.sticky-header {
top: 0;
}
/* When preview bar is present */
html.shopify-preview {
--header-offset: 44px;
}
.shopify-preview .sticky-header {
top: var(--header-offset);
}

Theme Editor Context

{# Detect theme editor #}
{%- if request.design_mode -%}
{# Theme editor specific code #}
<style>
/* Styles only in editor */
</style>
{%- endif -%}

Section Rendering API

// Handle section re-renders in theme editor
document.addEventListener('shopify:section:load', (event) => {
// Reinitialize components in the section
initializeSlider(event.target);
});
document.addEventListener('shopify:section:unload', (event) => {
// Cleanup before section is removed
destroySlider(event.target);
});
document.addEventListener('shopify:block:select', (event) => {
// Block was selected in editor
scrollToBlock(event.target);
});

Cart Token Issues

// Cart may have different tokens between contexts
// Always use relative URLs for cart operations
fetch('/cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
id: variantId,
quantity: 1,
}),
});

Currency Formatting

{# Use money filters consistently #}
{{ product.price | money }} {# $10.00 #}
{{ product.price | money_without_currency }} {# 10.00 #}
{{ product.price | money_with_currency }} {# $10.00 USD #}
{# For JavaScript #}
<script>
const price = {{ product.price | json }}; {# Cents: 1000 #}
const formatted = Shopify.formatMoney(price);
</script>

Predictive Search Limits

// Predictive search has rate limits
// Debounce search requests
let searchTimeout;
searchInput.addEventListener('input', () => {
clearTimeout(searchTimeout);
searchTimeout = setTimeout(() => {
performSearch(searchInput.value);
}, 300);
});

Testing Tools

Browser DevTools

## DevTools Features to Use
- Device emulation (mobile sizes)
- Network throttling (slow 3G)
- Disable cache
- Console for JavaScript errors
- Network tab for failed requests
- Application tab for storage issues

BrowserStack/LambdaTest

For testing real devices:

  • Multiple browser versions
  • Real iOS and Android devices
  • Screenshot comparisons
  • Video recording

Local Testing

Terminal window
# Serve theme locally with Shopify CLI
shopify theme dev
# Test on different devices on same network
# Use the network URL provided

Responsive Testing

Key Breakpoints

/* Common breakpoints */
@media (max-width: 479px) {
/* Small mobile */
}
@media (min-width: 480px) {
/* Large mobile */
}
@media (min-width: 768px) {
/* Tablet */
}
@media (min-width: 1024px) {
/* Desktop */
}
@media (min-width: 1200px) {
/* Large desktop */
}

Testing Matrix

## Viewport Testing
- [ ] 320px (iPhone SE)
- [ ] 375px (iPhone 12/13/14)
- [ ] 414px (iPhone Plus)
- [ ] 768px (iPad portrait)
- [ ] 1024px (iPad landscape)
- [ ] 1280px (Laptop)
- [ ] 1440px (Desktop)
- [ ] 1920px (Large display)

JavaScript Compatibility

Feature Detection

// Check for feature support
if ('IntersectionObserver' in window) {
// Use IntersectionObserver
} else {
// Fallback for older browsers
}
// CSS feature detection
if (CSS.supports('gap', '1rem')) {
// Gap is supported
}

Polyfills

{# Load polyfills conditionally #}
<script>
if (!('IntersectionObserver' in window)) {
document.write('<script src="{{ 'intersection-observer-polyfill.js' | asset_url }}"><\/script>');
}
</script>

Debugging Strategies

Console Logging

// Identify issues quickly
console.log('Cart:', cart);
console.error('Failed to add to cart:', error);
// Group related logs
console.group('Product Form');
console.log('Variant:', selectedVariant);
console.log('Quantity:', quantity);
console.groupEnd();

Liquid Debugging

{# Debug Liquid variables #}
<pre style="background: #f0f0f0; padding: 1rem;">
{{ product | json }}
</pre>
{# Conditional debug output #}
{%- if request.design_mode -%}
<!-- Debug: template = {{ template }} -->
{%- endif -%}

Testing Workflow

## Pre-Launch Testing Workflow
1. **Development Testing**
- Test in primary browser during development
- Check responsive at key breakpoints
- Verify JavaScript functionality
2. **Cross-Browser Testing**
- Test in all priority browsers
- Check mobile browsers on real devices
- Test tablet layouts
3. **Shopify-Specific Testing**
- Test in theme editor
- Test section re-rendering
- Test with apps installed
- Test checkout flow
4. **Edge Cases**
- Long content/titles
- Missing images
- Empty collections
- Sold out products
- Multiple currencies

Common Fixes

IssueFix
Layout broken in SafariCheck flexbox gap support
Sticky not working iOSAdd -webkit-sticky
Input zooming on iOSSet font-size: 16px minimum
100vh too tall on mobileUse 100dvh or JavaScript
Fonts not loadingCheck font-display property
Animations jankyUse transform over position

Practice Exercise

Test a theme across browsers:

  1. Create a testing checklist
  2. Test in Chrome, Safari, Firefox
  3. Test on iOS and Android devices
  4. Document issues found
  5. Apply fixes and retest

Key Takeaways

  1. Test priority browsers based on audience
  2. Safari has unique quirks especially on iOS
  3. Shopify context matters (editor, preview bar)
  4. Use feature detection not browser detection
  5. Real device testing catches issues emulators miss
  6. Document fixes for future reference
  7. Systematic testing catches more issues

What’s Next?

The next lesson covers Versioning, Releases, and Deployment for managing theme updates.

Finished this lesson?

Mark it complete to track your progress.

Discussion

Loading comments...