Skip to content

Commit 6bfecc7

Browse files
committed
Disable nav keys when on focusing any input/textarea
1 parent 3a4daf0 commit 6bfecc7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/content/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const links = Array.from(document.querySelectorAll('div > h3 > a:first-child, td
55
const nextPageLink = document.querySelector('#pnnext')
66
const prevPageLink = document.querySelector('#pnprev')
77
const searchInput = document.querySelector('#lst-ib')
8+
const formInputs = document.querySelectorAll('input, textarea')
89

910
// Constant var
1011
const LAST_INDEX = links.length - 1
@@ -56,8 +57,10 @@ const init = () => {
5657
return
5758
}
5859

59-
searchInput.addEventListener('focusin', () => activateNavigation(false))
60-
searchInput.addEventListener('focusout', () => activateNavigation(true))
60+
formInputs.forEach(el => {
61+
el.addEventListener('focusin', () => activateNavigation(false))
62+
el.addEventListener('focusout', () => activateNavigation(true))
63+
})
6164

6265
activateNavigation(true)
6366

0 commit comments

Comments
 (0)