Skip to content

Commit 9e0ccc5

Browse files
Fix escape not working when searchbar selected
1 parent 6235ef0 commit 9e0ccc5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustdoc/html/static/main.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,15 @@
240240
}
241241

242242
function handleShortcut(ev) {
243-
if (document.activeElement.tagName === "INPUT")
243+
if (document.activeElement.tagName === "INPUT" &&
244+
hasClass(document.getElementById('main'), "hidden")) {
244245
return;
246+
}
245247

246248
// Don't interfere with browser shortcuts
247-
if (ev.ctrlKey || ev.altKey || ev.metaKey)
249+
if (ev.ctrlKey || ev.altKey || ev.metaKey) {
248250
return;
251+
}
249252

250253
var help = document.getElementById("help");
251254
switch (getVirtualKey(ev)) {
@@ -1800,7 +1803,7 @@
18001803
if (!next) {
18011804
return;
18021805
}
1803-
if (checkIfThereAreMethods(next.childNodes) &&
1806+
if ((checkIfThereAreMethods(next.childNodes) || hasClass(e, 'method')) &&
18041807
(hasClass(next, 'docblock') ||
18051808
hasClass(e, 'impl') ||
18061809
(hasClass(next, 'stability') &&

0 commit comments

Comments
 (0)