Skip to content

Commit 112a347

Browse files
authored
Fix theme picker blur handler: always hide instead of switching
1 parent 95b1fe5 commit 112a347

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/librustdoc/html/render.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -874,15 +874,23 @@ fn write_shared(
874874
r#"var themes = document.getElementById("theme-choices");
875875
var themePicker = document.getElementById("theme-picker");
876876
877+
function showThemeButtonState() {{
878+
themes.style.display = "none";
879+
themePicker.style.borderBottomRightRadius = "3px";
880+
themePicker.style.borderBottomLeftRadius = "3px";
881+
}}
882+
883+
function hideThemeButtonState() {{
884+
themes.style.display = "block";
885+
themePicker.style.borderBottomRightRadius = "0";
886+
themePicker.style.borderBottomLeftRadius = "0";
887+
}}
888+
877889
function switchThemeButtonState() {{
878890
if (themes.style.display === "block") {{
879-
themes.style.display = "none";
880-
themePicker.style.borderBottomRightRadius = "3px";
881-
themePicker.style.borderBottomLeftRadius = "3px";
891+
showThemeButtonState();
882892
}} else {{
883-
themes.style.display = "block";
884-
themePicker.style.borderBottomRightRadius = "0";
885-
themePicker.style.borderBottomLeftRadius = "0";
893+
hideThemeButtonState();
886894
}}
887895
}};
888896
@@ -895,7 +903,7 @@ function handleThemeButtonsBlur(e) {{
895903
(!related ||
896904
(related.id !== "themePicker" &&
897905
(!related.parentNode || related.parentNode.id !== "theme-choices")))) {{
898-
switchThemeButtonState();
906+
hideThemeButtonState();
899907
}}
900908
}}
901909

0 commit comments

Comments
 (0)