On this page
What this issue is
When a modal (a popup box that sits over the page) opens, most scripts stop the page behind it from scrolling. They usually do this by adding overflow: hidden to the body or html element, or by setting position: fixed on the body. That is correct while the modal is open.
The bug appears when the modal closes but the lock stays. The popup disappears, yet the page will not scroll. Often it only happens on one close path, for example when the visitor submits the form inside the popup, presses Esc, or taps outside the box.
The modal locks scrolling on open, but the close code never removes the lock.
Why it costs you leads or sales
A visitor who closes a popup expects to carry on reading. If the page is frozen, they cannot reach the pricing, the form below the fold or the add-to-cart button. Many will assume the site is broken and leave. Some will reload, and a few will not come back.
It hurts most on mobile, where there is no scroll bar and no obvious way to recover. It also hurts most right after a popup form submit, the moment when a visitor is most engaged. The impact is medium: it does not stop every visit, but it quietly wastes traffic you paid for.
- Lands on pageReads the first screen
- Popup opensPage scroll is locked
- Closes popupLock is not removed
- Scrolls to offerPage will not move
- Form or checkoutNever reached
The visitor does what you asked, then hits a frozen page.
Example: illustrative numbers only. A page that scrolls again after close keeps far more visitors than one that stays frozen.
How to check if your site has it
Open the page in a fresh tab
Use a private window so saved cookies do not hide the popup. Trigger it by waiting, scrolling or clicking the button that opens it.
Close it with each method
Try the X button, a click on the dark overlay, the Esc key, and submitting the form inside it. Test one at a time, reloading between tries.
Try to scroll
Use the mouse wheel, keyboard arrow keys and, on a phone, a finger swipe. Check the page really moves.
Inspect the body and html elements
In Chrome, right-click the page, choose Inspect, and select the body and html tags. Look in Styles for overflow: hidden, position: fixed, a set height, or a class such as modal-open or no-scroll left behind.
Repeat on a real phone
iPhone Safari and Android Chrome behave differently from desktop. Remote debugging or a real device is more reliable than a resized desktop window.
| Where | What you see | What it means |
|---|---|---|
| body style | overflow: hidden | Lock added on open, never removed |
| body style | position: fixed; top: -1200px | Scroll-position trick left in place |
| body or html class | modal-open, no-scroll, is-locked | Class not removed on close |
| html style | overflow: hidden or height: 100% | A second lock on the html element |
| body style | padding-right: 15px | Scrollbar-width compensation left behind |
How to fix it
The fix is the same everywhere: whatever the open code adds, the close code must remove, on every close path. How you get there depends on your tool.
Find which plugin opens the popup
Deactivate popup, cookie and slider plugins one at a time on a staging copy and retest. The one whose removal fixes scrolling is the cause.
Update and check settings
Update the plugin and theme. Look in the popup's settings for options such as Disable page scrolling or Lock body scroll and test with it off.
Report or patch
If the bug remains, send the plugin author the exact close path that fails. As a stopgap, add the custom code from the Custom code tab through a child theme or a code snippets plugin.
Identify the source
Disable popup or announcement apps in the app settings, or switch off the theme's own modal section, and retest to find the culprit.
Check theme code
In Online Store > Themes > Edit code, search theme.liquid and the theme JavaScript for overflow, no-scroll and modal-open. Make sure the close function removes what the open function adds.
Update the app or theme
Install the latest version of the theme or app. If it persists, contact the developer with the failing close path.
Find popup tags
Popup tools are often loaded as Custom HTML tags. Use Preview mode and pause the tag that creates the popup, then retest.
Add a cleanup tag
If you cannot edit the popup tool, add a Custom HTML tag that fires on the close event and runs the unlock code from the Custom code tab.
Publish and retest
Check in Preview first, then publish and retest on mobile.
Check your interactions
If the modal uses Webflow interactions, open the close interaction and confirm it sets the body's overflow back to Auto, not just hides the modal.
Check every close trigger
The X button, the background click and any form success action each need the same close interaction.
Publish and test
Test on the published site, not only in the Designer preview.
Find the popup
In the funnel or website builder, open the page's popup element and check its close and form submit actions.
Remove custom scroll-lock code
Search the page's Custom Code and tracking code areas for overflow: hidden rules or scripts and remove ones that are not reversed on close.
Retest the published page
Open the live URL on a phone and test each close path.
Check the lightbox
In the Wix Editor, open the lightbox and review its close button and trigger settings.
Remove custom code
Under Settings > Custom Code, look for scripts that add overflow: hidden and remove or fix them.
Test the live site
Preview, then publish and test on mobile.
Review the popup setup
Check Pop-Up settings on the page and any code injection under Settings > Advanced > Code Injection.
Remove stale styles
Delete custom CSS that sets overflow: hidden on body without a matching reset.
Test on mobile
Open the live site on a phone and close the popup each way.
Pair lock and unlock
Put both in one function each, and call the unlock from every close path, including form success and route changes.
Use the native dialog element if you can
A dialog opened with showModal() handles focus and Esc for you, and you only need to manage scroll in one place.
Preserve scroll position on iOS
If you use position: fixed, save window.scrollY on open and restore it on close with window.scrollTo.
let savedScrollY = 0;
function lockScroll() {
savedScrollY = window.scrollY;
document.body.style.position = 'fixed';
document.body.style.top = `-${savedScrollY}px`;
document.body.style.width = '100%';
}
function unlockScroll() {
document.body.style.position = '';
document.body.style.top = '';
document.body.style.width = '';
window.scrollTo(0, savedScrollY);
}
function closeModal(modal) {
modal.hidden = true;
unlockScroll();
}
// Every close path calls closeModal
document.querySelector('.modal-close').addEventListener('click', () => closeModal(modalEl));
document.querySelector('.modal-overlay').addEventListener('click', () => closeModal(modalEl));
document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeModal(modalEl); });Broken
- Open code adds overflow: hidden
- Only the X button removes it
- Form submit or Esc leaves the page frozen
Fixed
- One unlock function
- Called from X, overlay, Esc and form success
- Scroll position restored on close
How to confirm it's fixed
- Page scrolls after closing with the X button
- Page scrolls after clicking the overlay
- Page scrolls after pressing Esc
- Page scrolls after submitting the popup form
- body and html have no leftover overflow: hidden, position: fixed or lock class in the inspector
- The page is back at the same scroll position, not jumped to the top
- Tested on iPhone Safari and Android Chrome
- Popup can be opened and closed twice in a row without issue
How to prevent it happening again
Scroll lock bugs usually return after a plugin, theme or popup tool update, or when a marketer adds a new popup with different close rules. Build a habit around that.
- Test popups on a phone after every theme, plugin or popup tool update
- Add each new popup to a short test list covering all four close paths
- Keep only one scroll-lock mechanism on the site, not one per plugin
- Prefer maintained popup tools or the native dialog element over custom code
- Note who owns popup changes so tests are not skipped
How FunnelGuard handles this
FunnelGuard does not check for this yet. A scroll-after-close check is a possible future addition, but today it is not part of what FunnelGuard runs, so do not rely on it to warn you about a frozen page.
What FunnelGuard does do is run your real customer journeys, such as lead forms, checkouts and booking or chat buttons, on a schedule with a robot visitor. It checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. A popup problem that stops a form or button from being used can show up as a failed journey step, but a page that simply will not scroll is not something it looks for.
To watch for scroll lock yourself, add the popup close test above to your release checklist and run it on a real phone after any change. You can also use a free browser tool such as Chrome DevTools to inspect the body styles. To see what FunnelGuard does catch, you can start with the free plan (1 site, 2 journeys, daily checks, no card) or request the free read-only website audit.
Questions people ask
Why can't I scroll after closing a popup on my website?
The popup almost certainly added overflow: hidden or position: fixed to the body or html element when it opened, and the close code never removed it. Inspect the body in your browser's developer tools to see the leftover style, then fix the close code so it removes it.
How do I unlock scrolling after a modal closes?
Remove whatever the modal added when it opened. That usually means resetting document.body.style.overflow to an empty string, or clearing position and top if you used position: fixed, then restoring the saved scroll position with window.scrollTo.
Why does scrolling only break when I submit the form inside the popup?
The form success handler probably hides the modal without calling the same unlock function as the X button. Make every close path, including form success, call one shared close function.
Why does the page jump to the top after closing a modal?
This happens when the lock uses position: fixed on the body without saving the scroll position. Store window.scrollY when the modal opens and call window.scrollTo(0, savedY) when it closes.
Why is scroll stuck only on iPhone after closing a modal?
iOS Safari handles overflow: hidden on the body differently from desktop browsers, so many scripts use position: fixed instead and sometimes forget to undo it. Test on a real iPhone and check the body styles for leftovers.
Is it safe to use overflow: auto !important to fix a stuck scroll?
It works as a quick patch but lets people scroll the page behind an open modal and can hide the real bug. Fix the close code instead and keep the override only as a short-term stopgap.
Does FunnelGuard detect scroll lock after closing a modal?
No. FunnelGuard does not check for this yet, though it is a possible future check. It does run your real journeys and report failed steps, so test popup closing manually on a phone.
How can I find which plugin is locking my scroll?
Disable popup, cookie banner and slider plugins one at a time on a staging copy and retest scrolling. The plugin whose removal fixes it is the cause, and you can then update it or report the bug.
Related issues
- CNV-112Popup covers the form or CTA and can't be closedFix guide
- CNV-113Close (X) button missing or off-screen on mobileFix guide
- CNV-118Modal opens behind overlay (z-index bug)Fix guide
- CNV-117Interstitial blocks content on mobile (Google penalty)Fix guide
- CNV-116Popup form submits but lead goes nowhereFix guide
- CNV-121Video modal doesn't loadFix guide