Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 12f0dba

Browse files
committedNov 12, 2020
Auto merge of rust-lang#78773 - GuillaumeGomez:theme-picker-shortcut, r=jyn514
Add shortcut for theme picker menu Follow-up of rust-lang#78584 Just like you can focus the search input by pressing "S", you can now access the theme picker menu by pressing "T" and navigate through the options only using the keyboard. cc `@notriddle` r? `@jyn514`
2 parents 55794e4 + 8b20e9b commit 12f0dba

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/librustdoc/html/static/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,15 @@ function defocusSearchBar() {
415415
displayHelp(true, ev);
416416
break;
417417

418+
case "t":
419+
case "T":
420+
displayHelp(false, ev);
421+
ev.preventDefault();
422+
var themePicker = getThemePickerElement();
423+
themePicker.click();
424+
themePicker.focus();
425+
break;
426+
418427
default:
419428
var themePicker = getThemePickerElement();
420429
if (themePicker.parentNode.contains(ev.target)) {
@@ -2852,6 +2861,7 @@ function defocusSearchBar() {
28522861
var shortcuts = [
28532862
["?", "Show this help dialog"],
28542863
["S", "Focus the search field"],
2864+
["T", "Focus the theme picker menu"],
28552865
["↑", "Move up in search results"],
28562866
["↓", "Move down in search results"],
28572867
["↹", "Switch tab"],

0 commit comments

Comments
 (0)
Please sign in to comment.