From 63963f4d497ebe25ac8c42935b4f0f80b915546b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 1 Nov 2024 20:16:43 +0100 Subject: [PATCH] Handle noscript style with "js" class on ``. --- util/gh-pages/index_template.html | 1 - util/gh-pages/noscript.css | 3 --- util/gh-pages/style.css | 5 +++++ util/gh-pages/theme.js | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 util/gh-pages/noscript.css diff --git a/util/gh-pages/index_template.html b/util/gh-pages/index_template.html index 31a1dc0e0926..95f185a54bc9 100644 --- a/util/gh-pages/index_template.html +++ b/util/gh-pages/index_template.html @@ -24,7 +24,6 @@ {# #} {# #} {# #} - {# #} {# #} {# #} {# #} diff --git a/util/gh-pages/noscript.css b/util/gh-pages/noscript.css deleted file mode 100644 index 907509ce314a..000000000000 --- a/util/gh-pages/noscript.css +++ /dev/null @@ -1,3 +0,0 @@ -#settings-dropdown, #menu-filters { - display: none; -} diff --git a/util/gh-pages/style.css b/util/gh-pages/style.css index 8c5d64ad4e41..896f2fdac767 100644 --- a/util/gh-pages/style.css +++ b/util/gh-pages/style.css @@ -230,6 +230,11 @@ details[open] { } } +html:not(.js) #settings-dropdown, +html:not(.js)#menu-filters { + display: none; +} + #settings-dropdown { position: absolute; margin: 0.7em; diff --git a/util/gh-pages/theme.js b/util/gh-pages/theme.js index bc296955ddfb..90f57d4469d1 100644 --- a/util/gh-pages/theme.js +++ b/util/gh-pages/theme.js @@ -45,6 +45,10 @@ function setTheme(theme, store) { } (function() { + // This file is loaded first. If so, we add the `js` class on the `` + // element. + document.documentElement.classList.add("js"); + // loading the theme after the initial load const prefersDark = window.matchMedia("(prefers-color-scheme: dark)"); const theme = loadValue("theme");