pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/python-docs-theme/commit/3f27d34ed682e2fce8dcc56b97bcc9557fb54bbe

> Allow / to be entered into search box, don't focus if edit already fo… · python/python-docs-theme@3f27d34 · GitHub
Skip to content

Commit 3f27d34

Browse files
committed
Allow / to be entered into search box, don't focus if edit already focused
1 parent 23f0b42 commit 3f27d34

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1+
function isInputFocused() {
2+
const activeElement = document.activeElement;
3+
return (
4+
activeElement.tagName === 'INPUT' ||
5+
activeElement.tagName === 'TEXTAREA' ||
6+
activeElement.isContentEditable
7+
);
8+
}
9+
110
document.addEventListener('keydown', function(event) {
211
if (event.key === '/') {
3-
// Prevent "/" from being entered in the search box
4-
event.preventDefault();
12+
if (!isInputFocused()) {
13+
// Prevent "/" from being entered in the search box
14+
event.preventDefault();
515

6-
// Set the focus on the search box
7-
let searchBox = document.getElementById('search-box');
8-
searchBox.focus();
16+
// Set the focus on the search box
17+
const searchBox = document.getElementById('search-box');
18+
searchBox.focus();
19+
}
920
}
1021
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy