about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-01-06 02:13:35 +0100
committerGitHub <noreply@github.com>2018-01-06 02:13:35 +0100
commitb3104178d6ebeb2244e3e502b98a142ebcc6030b (patch)
tree0edf1ff5861cc7bd77dc7363eab41b49c738ef8d
parent21b9822390323420ae3a2998f1c376606325a883 (diff)
parenteea860f84c9338fbd89c1afe0aedd2c344aa6476 (diff)
downloadrust-b3104178d6ebeb2244e3e502b98a142ebcc6030b.tar.gz
rust-b3104178d6ebeb2244e3e502b98a142ebcc6030b.zip
Rollup merge of #47202 - GuillaumeGomez:fix-defocus, r=QuietMisdreavus
Fix search bar defocus

Fixes #47134.

r? @QuietMisdreavus
-rw-r--r--src/librustdoc/html/static/main.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index c128a812b93..b4dbd76d0b4 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1132,6 +1132,10 @@
                     e.preventDefault();
                 } else if (e.which === 16) { // shift
                     // Does nothing, it's just to avoid losing "focus" on the highlighted element.
+                } else if (e.which === 27) { // escape
+                    removeClass(actives[currentTab][0], 'highlighted');
+                    document.getElementsByClassName('search-input')[0].value = '';
+                    defocusSearchBar();
                 } else if (actives[currentTab].length > 0) {
                     removeClass(actives[currentTab][0], 'highlighted');
                 }