We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aaa7063 commit a0af9efCopy full SHA for a0af9ef
2 files changed
.DS_Store
6 KB
content.js
@@ -1,11 +1,20 @@
1
let isEnabled = false;
2
3
function handleKeydown(event) {
4
+ // Check if the focused element is an input field or a textarea
5
+ var focusedElement = document.activeElement;
6
+ var isTyping = focusedElement.tagName === 'INPUT' || focusedElement.tagName === 'TEXTAREA';
7
+
8
+ // If the user is typing in an input field or a textarea, do not override the key
9
+ if (isTyping) {
10
+ return;
11
+ }
12
13
if (event.key === '/' && isEnabled) {
- event.preventDefault();
14
+ event.preventDefault(); // Prevent the default action
15
var searchBars = document.querySelectorAll('input[type="search"], input[type="text"]');
16
if (searchBars.length > 0) {
- searchBars[0].focus();
17
+ searchBars[0].focus(); // Focus on the first search bar found
18
}
19
20
0 commit comments