Skip to content

Commit

Permalink
Only toggle sidebar if it is closed (#305)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
MatheusRich authored Aug 24, 2024
1 parent ef9eab8 commit bd303bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});

0 comments on commit bd303bf

Please sign in to comment.