Skip to content

Commit 300362e

Browse files
committed
Close the theme picker when Escape is pressed
1 parent ffe5288 commit 300362e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/librustdoc/html/static/main.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Local js definitions:
55
/* global addClass, getCurrentValue, hasClass */
66
/* global onEachLazy, hasOwnProperty, removeClass, updateLocalStorage */
7+
/* global hideThemeButtonState */
78

89
if (!String.prototype.startsWith) {
910
String.prototype.startsWith = function(searchString, position) {
@@ -137,10 +138,6 @@ function defocusSearchBar() {
137138
sidebar.appendChild(div);
138139
}
139140
}
140-
var themePickers = document.getElementsByClassName("theme-picker");
141-
if (themePickers && themePickers.length > 0) {
142-
themePickers[0].style.display = "none";
143-
}
144141
}
145142

146143
function hideSidebar() {
@@ -155,10 +152,6 @@ function defocusSearchBar() {
155152
filler.remove();
156153
}
157154
document.getElementsByTagName("body")[0].style.marginTop = "";
158-
var themePickers = document.getElementsByClassName("theme-picker");
159-
if (themePickers && themePickers.length > 0) {
160-
themePickers[0].style.display = null;
161-
}
162155
}
163156

164157
function showSearchResults(search) {
@@ -376,6 +369,7 @@ function defocusSearchBar() {
376369
document.title = titleBeforeSearch;
377370
}
378371
defocusSearchBar();
372+
hideThemeButtonState();
379373
}
380374

381375
function handleShortcut(ev) {

0 commit comments

Comments
 (0)