Skip to content

Commit 677e6ed

Browse files
committed
(doc) Properly doc hotkeys in generated docs.
Updated search bar to match help text. Used correct, normalized hotkeys in search. Updated shortcut menu with working shortcuts (tabs). Changed height of search help.
1 parent bb06790 commit 677e6ed

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/librustdoc/html/layout.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ r##"<!DOCTYPE html>
6363
<div class="search-container">
6464
<input class="search-input" name="search"
6565
autocomplete="off"
66-
placeholder="Click or press 's' to search, '?' for more options..."
66+
placeholder="Click or press 'S' to search, '?' for more options..."
6767
type="search">
6868
</div>
6969
</form>
@@ -82,9 +82,9 @@ r##"<!DOCTYPE html>
8282
<dd>Show this help dialog</dd>
8383
<dt>S</dt>
8484
<dd>Focus the search field</dd>
85-
<dt>&uarr;</dt>
85+
<dt>&larrb;</dt>
8686
<dd>Move up in search results</dd>
87-
<dt>&darr;</dt>
87+
<dt>&rarrb;</dt>
8888
<dd>Move down in search results</dd>
8989
<dt>&#9166;</dt>
9090
<dd>Go to active search result</dd>

src/librustdoc/html/static/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ p a:hover { text-decoration: underline; }
347347
margin-top: -125px;
348348
margin-left: -275px;
349349
width: 550px;
350-
height: 250px;
350+
height: 300px;
351351
border: 1px solid #bfbfbf;
352352
}
353353

src/librustdoc/html/static/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
return;
7272
}
7373

74-
if (e.keyCode === 188 && $('#help').hasClass('hidden')) { // question mark
74+
if (e.which === 191 && $('#help').hasClass('hidden')) { // question mark
7575
e.preventDefault();
7676
$('#help').removeClass('hidden');
77-
} else if (e.keyCode === 27) { // esc
77+
} else if (e.which === 27) { // esc
7878
if (!$('#help').hasClass('hidden')) {
7979
e.preventDefault();
8080
$('#help').addClass('hidden');
@@ -83,7 +83,7 @@
8383
$('#search').addClass('hidden');
8484
$('#main').removeClass('hidden');
8585
}
86-
} else if (e.keyCode === 83) { // S
86+
} else if (e.which === 83) { // S
8787
e.preventDefault();
8888
$('.search-input').focus();
8989
}
@@ -361,23 +361,23 @@
361361
$(document).on('keypress.searchnav', function(e) {
362362
var $active = $results.filter('.highlighted');
363363

364-
if (e.keyCode === 38) { // up
364+
if (e.which === 38) { // up
365365
e.preventDefault();
366366
if (!$active.length || !$active.prev()) {
367367
return;
368368
}
369369

370370
$active.prev().addClass('highlighted');
371371
$active.removeClass('highlighted');
372-
} else if (e.keyCode === 40) { // down
372+
} else if (e.which === 40) { // down
373373
e.preventDefault();
374374
if (!$active.length) {
375375
$results.first().addClass('highlighted');
376376
} else if ($active.next().length) {
377377
$active.next().addClass('highlighted');
378378
$active.removeClass('highlighted');
379379
}
380-
} else if (e.keyCode === 13) { // return
380+
} else if (e.which === 13) { // return
381381
e.preventDefault();
382382
if ($active.length) {
383383
document.location.href = $active.find('a').prop('href');

0 commit comments

Comments
 (0)