Skip to content

Commit 2a56ae6

Browse files
sanityclaude
andcommitted
fix: screenshot lightbox positioning by appending overlay to body
position:fixed inside CSS grid ancestors doesn't work reliably. Switched to a small JS approach that creates the lightbox overlay directly on document.body, ensuring correct fullscreen positioning. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 49b9c59 commit 2a56ae6

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

hugo-site/content/_index.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ are unstoppable, interoperable, and built on open protocols.
2020
River is a decentralized group chat built on Freenet. No servers, no signups—just encrypted
2121
conversations that work even if we disappear tomorrow.
2222

23-
<div class="screenshot-container" onclick="this.classList.toggle('expanded')">
23+
<div class="screenshot-container">
2424
<picture class="app-screenshot">
2525
<source srcset="/images/river-screenshot-dark.png" media="(prefers-color-scheme: dark)">
2626
<img src="/images/river-screenshot-light.png" alt="River - decentralized chat on Freenet">
2727
</picture>
2828
</div>
2929

30+
<script>
31+
document.addEventListener('DOMContentLoaded', function() {
32+
var container = document.querySelector('.screenshot-container');
33+
if (!container) return;
34+
container.addEventListener('click', function() {
35+
var img = container.querySelector('img');
36+
var overlay = document.createElement('div');
37+
overlay.className = 'screenshot-lightbox';
38+
var clone = document.createElement('img');
39+
clone.src = img.currentSrc || img.src;
40+
clone.alt = img.alt;
41+
overlay.appendChild(clone);
42+
overlay.addEventListener('click', function() { overlay.remove(); });
43+
document.body.appendChild(overlay);
44+
});
45+
});
46+
</script>
47+
3048
</div>
3149

3250
<div class="news-column">

hugo-site/themes/freenet/assets/css/freenet.css

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,6 @@ p.page-end-spacer {
606606
opacity: 1;
607607
}
608608

609-
.screenshot-container.expanded::after {
610-
display: none;
611-
}
612-
613609
picture.app-screenshot {
614610
display: block;
615611
max-width: 100%;
@@ -621,11 +617,10 @@ picture.app-screenshot img {
621617
border: 1px solid rgba(0, 0, 0, 0.08);
622618
max-width: 100%;
623619
height: auto;
624-
transition: all 0.3s ease;
625620
}
626621

627-
/* Expanded state - fullscreen lightbox */
628-
.screenshot-container.expanded {
622+
/* Fullscreen lightbox (appended to body via JS) */
623+
.screenshot-lightbox {
629624
position: fixed;
630625
top: 0;
631626
left: 0;
@@ -639,15 +634,7 @@ picture.app-screenshot img {
639634
cursor: zoom-out;
640635
}
641636

642-
.screenshot-container.expanded picture.app-screenshot {
643-
position: relative;
644-
z-index: 1;
645-
max-width: 90vw;
646-
max-height: 90vh;
647-
margin: 0;
648-
}
649-
650-
.screenshot-container.expanded picture.app-screenshot img {
637+
.screenshot-lightbox img {
651638
max-width: 90vw;
652639
max-height: 90vh;
653640
object-fit: contain;

0 commit comments

Comments
 (0)