Safari-Specific React Animation Issues: Infinite Scroll Breaking on MacBook

I'm encountering a browser-specific issue with a React infinite scroll animation component. The animation works perfectly in Chrome on MacBook, but breaks specifically in Safari:

  • ✅ Chrome on MacBook: Works perfectly
  • ❌ Safari on MacBook: Animation and layout issues

Technical Details

Environment

  1. Browser: Safari: Version 18.1.1 (20619.2.8.11.12)
  2. MacBook 13-inch display
  3. React 18
  4. GSAP for animations
  5. TailwindCSS for styling
  6. Next.js/TypeScript project

Implementation

const MovingGrid: React.FC = () => {
  useEffect(() => {
    const initAnimation = () => {
      const container = containerRef.current;
      if (container) {
        gsap.to(container, {
          x: `-${firstSet.clientWidth}`,
          duration: 30,
          ease: "none",
          repeat: -1,
          onRepeat: () => {
            gsap.set(container, { x: 0 });
          }
        });
      }
    };
  }, []);

  return (
    <div className="hidden lg:block overflow-hidden w-full relative">
      <div ref={containerRef} className="flex absolute -bottom-[100px]">
        {/* Grid content */}
      </div>
    </div>
  );
};

Safari-Specific Behavior

Images overflow the container in Safari only Layout gets disrupted when animation resets Same code works perfectly in Chrome on the same machine

Cross-Browser Testing Results

Safari on MacBook: Issues with animation and layout Chrome on MacBook: Works as expected Firefox on MacBook: Works as expected Safari on iOS: Needs testing Chrome on Windows: Works as expected

Attempted Solutions

  1. Safari-specific CSS fixes:
/* Attempted Safari-specific fixes */
@supports (-webkit-hyphens:none) {
  .moving-grid {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
}
  1. Modified GSAP configuration for Safari:
gsap.config({
  force3D: true
});
  1. Tried various CSS transform and positioning approaches:
className="transform will-change-transform"
style={{ WebkitTransform: 'translate3d(0,0,0)' }}

Questions

  1. Are there known Safari-specific issues with GSAP animations that require special handling?
  2. Does Safari handle infinite scroll animations differently from Chrome in terms of performance or rendering?
  3. Are there recommended Safari-specific optimizations for smooth animations?
  4. Should we implement a different animation approach specifically for Safari users?

Investigation Notes

  1. Performance metrics show no significant issues
  2. Animation frame rate is consistent
  3. Layout calculations appear correct before animation starts

Impact

This issue affects a crucial part of our property showcase website, specifically impacting Safari users on MacBook devices. Given Safari's significant user base on MacBooks, this needs to be resolved for a consistent cross-browser experience.

Additional Context

  1. The animation is part of a larger property showcase feature
  2. Performance is crucial for user experience
  3. Need to maintain visual consistency across browsers

Reproduction Steps

  • Open website Safari on MacBook [pinkdoorbnb .com]
  • Observe the infinite scroll animation
  • Compare with Chrome on the same device
  • Note the differences in animation behaviour and layout

I would greatly appreciate any insights into Safari-specific animation handling or alternative approaches that work consistently across browsers.

Here is sample Google Chrome ⬇

Safari ⬇

Safari-Specific React Animation Issues: Infinite Scroll Breaking on MacBook
 
 
Q