From 4f606bb3ee0bbea4ae2a1fdb9f950f1d2d13bfb2 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Sat, 24 Aug 2024 18:27:54 -0300 Subject: [PATCH] Only toggle sidebar if it is closed We were toggling the sidebar regardless of whether it was open or closed. This caused the back button to close the sidebar on the desktop instead of opening it (because it was already open). --- app/assets/javascripts/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index aa37c8ee..50e91152 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,6 +15,6 @@ window.addEventListener("turbolinks:load", () => { if (window.matchMedia("(min-width: 768px)").matches) { - document.querySelector("#sidebar summary").click(); + document.querySelector("#sidebar details:not(open) summary")?.click(); } });