1function isInputFocused() { 2 const activeElement = document.activeElement; 3 return ( 4 activeElement.tagName === 'INPUT' || 5 activeElement.tagName === 'TEXTAREA' || 6 activeElement.isContentEditable 7 ); 8} 9 10document.addEventListener('keydown', function(event) { 11 if (event.key === '/') { 12 if (!isInputFocused()) { 13 // Prevent "/" from being entered in the search box 14 event.preventDefault(); 15 16 // Set the focus on the search box 17 const searchBox = document.getElementById('search-box'); 18 searchBox.focus(); 19 } 20 } 21});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.