Skip to main content
Contributor I
Nov 25, 2026 12:57 AM UTC

Fix: phone page won't scroll after closing a Klaviyo popup (invisible popup layer stays behind)

If shoppers on iPhone can't scroll your site after closing your Klaviyo popup, here's what we found and how we fixed it.

Symptom: the popup closes, but the page freezes. Swiping does nothing until you reload. Desktop is fine. For us it happened when the popup opened while the shopper was scrolling (a "show after scrolling X%" trigger).

What's happening: on iPhone, the popup starts its fade-out but never finishes closing. It stays on the page, fully transparent, covering the whole screen. Every swipe lands on that invisible layer, and the page stays scroll-locked (the klaviyo-prevent-body-scrolling class stays on <body>). That's why "unlock body scroll" fixes alone don't work: the invisible layer is still catching every touch.

How we confirmed it: we added a small on-screen readout to a test page. After closing the popup it still showed the popup as open, the body still locked, and every touch landing on a Klaviyo kl-private-reset-css element.

The fix: we added a short script to the theme, just before </body>. It watches for a popup that was shown and then faded out but is still there, and removes it. It touches nothing while the popup is visible.

<script>(function(){  var seen=false, since=0;  function op(el){var o=1;while(el&&el.nodeType===1){var s=getComputedStyle(el);if(s.display==='none'||s.visibility==='hidden')return 0;o*=parseFloat(s.opacity||'1');el=el.parentElement;}return o;}  function top(el){while(el&&el.parentElement&&el.parentElement!==document.body)el=el.parentElement;return el;}  setInterval(function(){    var p=document.querySelector('[data-testid="POPUP"]');    if(!p){seen=false;since=0;return;}    var o=op(p);    if(o>0.6){seen=true;since=0;return;}    if(seen&&o<0.15){      if(!since)since=Date.now();      else if(Date.now()-since>700){        var l=top(document.querySelector('[data-kl-scroll-locking-modal="true"]')||p);        if(l)l.style.setProperty('display','none','important');        document.body.classList.remove('klaviyo-prevent-body-scrolling');        seen=false;since=0;      }    }  },250);})();</script>

Tested on iPhone (Chrome) on a Shopify Horizon theme: before the fix the page froze every time; after it, scrolling comes back within a second.

One more tip: on phones, turn off "close when clicking outside the form." Shoppers tap outside by accident while scrolling, and it closes the popup before they've read it.

Hope this saves someone a few hours.

Wim, The Benchmark