Hi everyone,
I’m reporting what appears to be a critical bug with lightboxes on mobile devices.
Any help is greatly appreciated.
What I’m Trying to Do:
I’m using a lightbox as a mobile navigation menu, and I want to close it when the user clicks a text button (styled as an X) in the top-right corner.
Setup:
- Button Type: Text Button
- ID: closeIcon
- Placed inside the lightbox
- Not grouped, not hidden, not collapsed
- Lightbox code is active and correctly targeting the button
Code I Used (Expected to Work):
import wixWindow from ‘wix-window’;
$w.onReady(function () {
$w(‘#closeIcon’).onClick(() => {
wixWindow.closeLightbox();
});
});
What Happens:
- When I tap the X button, the console logs fire properly (“CLICKED” appears)
- The button is active and responds to touch
- But the lightbox does not close — not in Preview or on Live mobile site
- Even alternate buttons inside the lightbox fail to close it using .closeLightbox()
Workaround That Does Work:
I replaced the closeLightbox() call with a redirect to the page the user is on, and that forces the lightbox to close.
import wixLocation from ‘wix-location’;
$w.onReady(function () {
$w(‘#closeIcon’).onClick(() => {
wixLocation.to(wixLocation.url); // Reloads current page
});
});
**This gives the illusion that the menu was closed, and the user experience is clean — but this is only a workaround.
My Question:
Is this a known Wix issue?
Why does wixWindow.closeLightbox() trigger the log but fail to actually close the lightbox on mobile?
Would appreciate an official answer or known fix.
Thanks so much.
— Tonya