Skip to content

Commit b310417

Browse files
Rollup merge of #47202 - GuillaumeGomez:fix-defocus, r=QuietMisdreavus
Fix search bar defocus Fixes #47134. r? @QuietMisdreavus
2 parents 21b9822 + eea860f commit b310417

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustdoc/html/static/main.js

+4
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)