chiark / gitweb /
doxygen: make it possible to focus the already-shown search input.
authorVladimír Vondruš <mosra@centrum.cz>
Wed, 2 Jan 2019 00:11:48 +0000 (01:11 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Wed, 2 Jan 2019 21:07:36 +0000 (22:07 +0100)
For example when going back. Until now I had to use the mouse.

doxygen/search.js

index 330351a7fd3a29ec3326c966d084c6e0bee5ed81..c454cec961bd382c047f4a6f1e7e5d4f3b977a67 100644 (file)
@@ -557,6 +557,11 @@ if(typeof document !== 'undefined') {
             if(event.key == 'Escape') {
                 hideSearch();
 
+            /* Focus the search input, if not already, using T or Tab */
+            } else if((!document.activeElement || document.activeElement.id != 'search-input') && (event.key.toLowerCase() == 't' || event.key == 'Tab') && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) {
+                document.getElementById('search-input').focus();
+                return false; /* so T doesn't get entered into the box */
+
             /* Select next item */
             } else if(event.key == 'ArrowDown' || (event.key == 'Tab' && !event.shiftKey)) {
                 let current = document.getElementById('search-current');