Skip to content

Commit eea860f

Browse files
Fix search bar defocus
1 parent 8e7a609 commit eea860f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustdoc/html/static/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,10 @@
11321132
e.preventDefault();
11331133
} else if (e.which === 16) { // shift
11341134
// Does nothing, it's just to avoid losing "focus" on the highlighted element.
1135+
} else if (e.which === 27) { // escape
1136+
removeClass(actives[currentTab][0], 'highlighted');
1137+
document.getElementsByClassName('search-input')[0].value = '';
1138+
defocusSearchBar();
11351139
} else if (actives[currentTab].length > 0) {
11361140
removeClass(actives[currentTab][0], 'highlighted');
11371141
}

0 commit comments

Comments
 (0)