wixWindow.lightbox.close() error

workerLogger.js:53 Wix code SDK error: The current page is not a lightbox and therefore cannot be closed
Is it possible to programmatically close a lightbox? If so, how?

Page:

import wixWindow from 'wix-window';
$w.onReady(function () {
	wixWindow.openLightbox('LightboxManual')
		.then(() => console.log('closing'))
		.catch((error) => console.log('error', error))
	setTimeout(() => {
		console.log('time to close lightbox')
		//$w('#lightbox1').close()
		wixWindow.lightbox.close()
		// Wix code SDK error: The current page is not a lightbox and therefore cannot be closed
	}, 5000)
})

Lightbox Settings:
It does not matter. I tried all combinations.

Hi,
Yes there is.
This syntax is correct but you should place it in the lightbox code.

wixWindow.lightbox.close();

Good luck!
Roi

@Roi Bendet is it possible for a page to close the lightbox? It seems weird that a page can open a lightbox but cannot close it.

Hi,
No. because in that particular time the page that opens the lightbox stops the javascript flow. That is why
you need to close is from the lightbox it self.
Roi

Got it. The lightbox global variable on wixWindow could reference the current lightbox. I’ll add a feature request for something like $w('#myLightbox).close(…).