fix: auto-collapse playground menu on mobile (#2430) (#2431)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled

* fix: auto-collapse playground menu on mobile (#2430)

* style: remove unused code reference after review
This commit is contained in:
Sanjeev
2026-02-07 00:00:19 +05:30
committed by GitHub
parent 10e1999304
commit 06fe07e384
+7 -2
View File
@@ -1,3 +1,4 @@
/* global require, monaco, clarity */
let editor;
// on document load
document.addEventListener('DOMContentLoaded', function () {
@@ -86,7 +87,6 @@ document.addEventListener('keydown', function (e) {
}
});
var code = document.getElementById('code');
var run = document.getElementById('run');
run.addEventListener('click', function () {
loadStringInIframe(editor.getValue());
@@ -193,6 +193,11 @@ document.addEventListener('click', function (e) {
const sidebarItem = e.target.closest('.sidebar-item');
if ( ! sidebarItem ) return;
// Collapse sidebar by default on mobile after clicking a link
if ( window.innerWidth <= 768 ) {
sidebarContainer.classList.add('collapsed');
}
// Don't intercept if modifier keys are pressed
if ( e.metaKey || e.ctrlKey || e.shiftKey || e.altKey ) return;
@@ -336,7 +341,7 @@ document.addEventListener('click', function (e) {
// Handle popstate (back/forward navigation) with reload
window.addEventListener('popstate', function () {
if ( window.history.state && window.history.state.reload ) {
window.location.href = window.location.href;
window.location.reload();
}
});