Prettier
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/deploy Pipeline was successful

This commit is contained in:
2026-02-16 10:01:29 -03:00
parent af70682fa8
commit 7870d3b3bd
4 changed files with 55 additions and 12 deletions

View File

@@ -29,9 +29,11 @@ if (themeToggle) {
const dialog = document.querySelector('dialog.lightbox');
const lbContent = dialog?.querySelector('.lb-content');
const lbCaption = dialog?.querySelector('#lb-caption, .lb-caption');
let lightboxOpener = null;
function openLightbox(name, type, caption) {
if (!dialog || !lbContent || !lbCaption) return;
lightboxOpener = document.activeElement;
document.body.style.overflow = 'hidden';
if (type === 'video') {
@@ -55,6 +57,10 @@ function openLightbox(name, type, caption) {
function closeLightbox() {
if (!dialog) return;
if (lightboxOpener && typeof lightboxOpener.focus === 'function') {
lightboxOpener.focus();
}
lightboxOpener = null;
document.body.style.overflow = '';
if (lbContent) lbContent.innerHTML = '';
if (lbCaption) lbCaption.textContent = '';
@@ -73,8 +79,8 @@ if (dialog) {
});
dialog.addEventListener('close', closeLightbox);
dialog.addEventListener('cancel', closeLightbox);
dialog.addEventListener('click', () => {
if (e.target === dialog) dialog.close();
dialog.addEventListener('click', (e) => {
if (e.target === dialog) closeLightbox();
});
}