On this page
What this issue is
A modal is a popup box that sits on top of the page, usually with a dark overlay (also called a backdrop) behind it. The browser decides what sits on top using z-index, a CSS number where higher means closer to the viewer. This bug happens when the overlay ends up above the modal. You see the page darken, but the box with the form or offer is hidden, or visible but unclickable because the overlay catches every click.
- Visitor clicks CTAButton works and triggers the modal
- Modal opensOverlay appears on top of the modal
- Form filled inFields can't be reached or typed into
- Lead submittedNever happens
The click on the CTA works, the modal opens, but it renders under the overlay.
Why it costs you leads or sales
Example: illustrative numbers only. A working modal vs one hidden behind the overlay.
How to check if your site has it
Trigger the modal on desktop and mobile
Click every button that opens a popup: CTAs, cart, booking, chat, newsletter. Use a private window so cookies don't hide it. Also test on a real phone or Chrome DevTools device mode.
Try to click and type inside it
If the page is dimmed and the fields don't respond, or the close button does nothing, the overlay is on top.
Inspect the elements
Right-click the dimmed area, choose Inspect, and see which element receives the click. If it is the overlay or backdrop class, the modal is underneath.
Compare z-index values
In DevTools, select the modal and the overlay and compare the Computed z-index. Then walk up the modal's parents looking for transform, filter, opacity, or position with z-index. Those create a stacking context.
Check other pages and states
Test logged in and logged out, with the sticky header showing, with a cookie banner open, and with a chat widget loaded. Another layer is often the culprit.
const el = document.elementFromPoint(window.innerWidth / 2, window.innerHeight / 2);
console.log(el);
let n = el;
while (n) {
const s = getComputedStyle(n);
console.log(n.tagName, n.className, 'z-index:', s.zIndex, 'position:', s.position, 'transform:', s.transform);
n = n.parentElement;
}How to fix it
.modal-overlay {
position: fixed;
inset: 0;
z-index: 1000;
}
.modal {
position: fixed;
z-index: 1001; /* higher than the overlay */
}Find which plugin or theme makes the popup
Inspect the modal and note its class name (for example from a popup plugin, page builder or theme). Then update that plugin and theme first, as many stacking bugs are fixed in releases.
Add override CSS
Go to Appearance > Customize > Additional CSS (or your child theme stylesheet) and set a higher z-index on the modal class than on the overlay class. Use the class names you found.
Check sticky headers and other plugins
If the header, cookie banner or chat widget sits above the modal, lower its z-index or raise the modal above it. Clear page and CDN caches afterwards.
Identify the source
Check whether the popup comes from your theme (cart drawer, quick view) or an app (email capture, reviews, upsell). Inspect it to find the class or app ID.
Add CSS in the theme
In Online Store > Themes > Edit code, open your main CSS file (the name depends on the theme) and add a z-index rule for the modal that is higher than the overlay.
Check app settings
Many apps have a z-index or layout setting. If not, contact the app developer. Test with the app embed turned off to confirm it is the cause.
Find tags that inject popups
Look for Custom HTML tags that add a popup, survey or chat widget. Preview with Tag Assistant and see if the bug appears only when that tag fires.
Set z-index in the injected CSS
Edit the tag's CSS so the modal has a higher z-index than the overlay, or append the modal to document.body so it isn't inside a transformed parent.
Publish and re-test
Publish a new container version and check the modal again in a private window.
Select the modal and the overlay
In the Navigator, find both elements. Check the Position settings in the Style panel for z-index.
Move the modal to the top level
Drag the modal wrapper out of any parent that has a Transform, Filter or Opacity effect, ideally directly under Body.
Set z-index and publish
Give the modal a higher z-index than the overlay and the navbar, then publish and test on the live site, as the Designer preview can differ.
Find the popup element
In the funnel or website builder, open the popup settings and check whether a section, sticky bar or custom code sits above it.
Add custom CSS
In the page's Custom CSS (Settings), add a rule that gives the popup container a higher z-index than the overlay. Use the class you find by inspecting the live page.
Test published, not just preview
Publish and open the live URL on desktop and mobile.
Check the lightbox and layers
In the Wix Editor, open the lightbox and check the Layers panel. Elements outside the lightbox set to appear on all pages, such as sticky headers, can sit above it.
Adjust layer order
Move the conflicting element down or turn off its pinned-to-screen setting.
Re-test live
Publish and test. If an app causes it, contact its support; Wix doesn't expose z-index directly, but Velo custom code can add CSS if you use it.
Identify the popup source
Check whether it is a built-in Promotional Pop-Up, a Lightbox, or an injected third-party script.
Add CSS
Go to Website > Website Tools > Custom CSS (menu names can vary by version) and add a z-index rule for the modal class you found by inspecting it.
Check header and announcement bar
If a fixed header or announcement bar covers the modal, lower its z-index or raise the modal's. Test on mobile.
Render the modal at the end of body
Move the modal markup to be a direct child of body (or use a portal in React, Vue or similar). This removes parent stacking contexts.
Use a z-index scale
Define variables, for example header 100, overlay 1000, modal 1001, toast 1100, and use them everywhere.
Consider the native dialog element
Calling showModal() on a dialog element puts it in the browser's top layer, above all z-index values, so the bug can't happen.
<dialog id="quote-modal">
<form method="dialog">
<!-- your form fields -->
<button>Close</button>
</form>
</dialog>
<script>
document.getElementById('quote-modal').showModal();
</script>Before
- Overlay z-index higher than modal
- Modal nested in a transformed wrapper
- Page dims, fields can't be clicked
After
- Modal z-index higher than overlay and header
- Modal rendered directly under body
- Form is clickable and submits
How to confirm it's fixed
- Open the modal on desktop and on a real phone; the box is on top of the dark overlay.
- Click into each field, type, and press the close button.
- Submit a test entry and confirm it arrives in your inbox or CRM.
- Test with the sticky header, cookie banner and chat widget visible.
- Run the console snippet again: the first element should be inside your modal.
- Test in at least Chrome and Safari, since stacking behaviour can differ.
How to prevent it happening again
- Keep one documented z-index scale and reuse it.
- Render modals at the top level of the page, or use the native dialog element.
- Avoid transform, filter and opacity on wrappers that contain modals.
- Re-test popups after theme, plugin, app or page builder updates.
- Test again whenever you add a sticky bar, chat widget or cookie banner.
- Schedule an automatic check of your key popup journeys.
Day 0
A theme or plugin update changes the overlay's z-index or adds a transform to a wrapper.
Day 1
Visitors click the CTA, see a dimmed page and leave. Nobody reports it.
Week 2
Leads from that page drop and you start looking at ads or traffic.
Fix day
You spot the layering issue, adjust the CSS and re-test.
How FunnelGuard handles this
Questions people ask
Why is my modal opening behind the overlay?
The overlay has a higher z-index than the modal, or the modal sits inside a parent element that creates its own stacking context (for example with transform, filter or opacity). In both cases the overlay renders on top. Raise the modal's z-index above the overlay and move it to the top level of the page.
Why is z-index not working on my popup?
z-index only applies to positioned elements (relative, absolute, fixed or sticky) and only competes within the same stacking context. If a parent has transform, filter, opacity below 1 or its own z-index, your popup is trapped inside it. Move the popup out of that parent or remove the property.
How do I make a modal appear on top of everything?
Render it as a direct child of body and give it a z-index higher than the overlay and any sticky header. Or use the native dialog element with showModal(), which places it in the browser's top layer above all z-index values.
Why is my popup hidden behind the sticky header?
The header's z-index is higher than the popup's, or they are in different stacking contexts. Lower the header's z-index or raise the modal's, and check that the modal isn't nested inside a transformed wrapper.
How can I find which element is covering my modal?
Open the modal, right-click the dimmed area and choose Inspect, or run document.elementFromPoint() in the console at the centre of the screen. The element it returns is what's on top. Then check its z-index and its parents' stacking contexts.
Can a z-index bug cause lost leads without any error?
Yes. The CTA click works and no script error appears, so analytics can look normal while visitors can't use the form. That's why you need to test the modal visually or run a journey check that tries to complete the step.
Does FunnelGuard detect a modal hidden behind an overlay?
Partly. It runs your journey on a schedule and flags when a click is covered by another element or a step can't be completed, with a screenshot and likely cause. It doesn't inspect your CSS or judge visual layering, so check popups by hand after changes.
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-120Scroll locked after closing modalFix guide
- CNV-116Popup form submits but lead goes nowhereFix guide
- CNV-121Video modal doesn't loadFix guide
- CNV-114Popup reappears on every pageFix guide