Skip to content

Commit c2c38fa

Browse files
committed
fix(sidebar): prevent sidebar from appearing when scrolling on playground
The sidebar visibility was not respecting the playgroundActive state, causing it to appear when scrolling on the Playground section even though the Playground view should remain sidebar-free. Fixed by adding a playgroundActive check to the checkAndToggleSidebar() function to ensure the sidebar is always hidden when Playground is active, regardless of scroll position. Fixes steam-bell-92#1364
1 parent 27379ae commit c2c38fa

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

web-app/js/main.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,20 @@ document.addEventListener("DOMContentLoaded", function () {
816816
if (stickyTabs.length) syncStickyTabs("all");
817817

818818
/* ── Sidebar Active Scroll Observer ───────────────────────── */
819-
if (!pageCategory && projectsSection) {
819+
if (!pageCategory && projectsSection) {
820820
console.log('Setting up sidebar observer');
821821

822822
const checkAndToggleSidebar = () => {
823+
// FIX #1364: Never show sidebar if Playground is active
824+
if (playgroundActive) {
825+
document.body.classList.remove("sidebar-active");
826+
const fixedThemeToggle = document.getElementById("fixed-theme-toggle");
827+
if (fixedThemeToggle) {
828+
fixedThemeToggle.style.display = "block";
829+
}
830+
return;
831+
}
832+
823833
if (window.innerWidth <= 768) {
824834
return;
825835
}
@@ -830,10 +840,9 @@ document.addEventListener("DOMContentLoaded", function () {
830840
const showSidebar = rect.top < window.innerHeight && window.scrollY > heroBottom - 100;
831841

832842
document.body.classList.toggle("sidebar-active", showSidebar);
833-
console.log('Sidebar active:', showSidebar, 'scrollY:', window.scrollY);
843+
console.log('Sidebar active:', showSidebar, 'scrollY:', window.scrollY, 'playgroundActive:', playgroundActive);
834844

835845
// Hide fixed-theme-toggle if sidebar is active
836-
837846
const fixedThemeToggle = document.getElementById("fixed-theme-toggle");
838847
if (fixedThemeToggle) {
839848
if (showSidebar) {
@@ -843,12 +852,12 @@ document.addEventListener("DOMContentLoaded", function () {
843852
fixedThemeToggle.style.display = "block";
844853
}
845854
}
846-
847855
};
848856

849857
window.addEventListener('scroll', checkAndToggleSidebar);
850858
checkAndToggleSidebar();
851-
}
859+
}
860+
852861
/* ═══════════════════════════════════════════════════════════════
853862
SEARCH - FIXED & IMPROVED
854863
═══════════════════════════════════════════════════════════════ */

0 commit comments

Comments
 (0)