From 8b20e9b47847d911c2eed11f1471c99b898ac932 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 5 Nov 2020 14:24:45 +0100 Subject: [PATCH] Add shortcut for theme picker menu --- src/librustdoc/html/static/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index de4792a5bd2f7..10342679cf474 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -415,6 +415,15 @@ function defocusSearchBar() { displayHelp(true, ev); break; + case "t": + case "T": + displayHelp(false, ev); + ev.preventDefault(); + var themePicker = getThemePickerElement(); + themePicker.click(); + themePicker.focus(); + break; + default: var themePicker = getThemePickerElement(); if (themePicker.parentNode.contains(ev.target)) { @@ -2852,6 +2861,7 @@ function defocusSearchBar() { var shortcuts = [ ["?", "Show this help dialog"], ["S", "Focus the search field"], + ["T", "Focus the theme picker menu"], ["↑", "Move up in search results"], ["↓", "Move down in search results"], ["↹", "Switch tab"],