From 00b45b967e0c92714e1ec54a2d5c924f8b1dd38b Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 16 Feb 2022 21:44:19 +0100 Subject: [PATCH] Fix edge case where settings/admin page sidebar would be incorrectly hidden (#17580) --- app/javascript/packs/public.js | 8 +------- app/javascript/styles/mastodon/admin.scss | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index c0c0886461..3d0a937e1f 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -276,13 +276,7 @@ function main() { }); delegate(document, '.sidebar__toggle__icon', 'click', () => { - const target = document.querySelector('.sidebar ul'); - - if (target.style.display === 'block') { - target.style.display = 'none'; - } else { - target.style.display = 'block'; - } + document.querySelector('.sidebar ul').classList.toggle('visible'); }); // Empty the honeypot fields in JS in case something like an extension diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index f5741bd502..1921eb1466 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -322,6 +322,10 @@ $content-width: 840px; & > ul { display: none; + + &.visible { + display: block; + } } ul a,