Skip to content

Commit b28386f

Browse files
committed
Ignore F key when typing
Resolves #1 I can't just have the event listener on a parent of the video as I'd thought, since F works when anything in the page which isn't a textbox is focused.
1 parent b92fb72 commit b28386f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extension/contentScript.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
setTimeout(showFluff, 40)
2626
}
2727

28+
const isWritingText = (e) => (
29+
e.path[0].tagName == 'INPUT' ||
30+
e.path[0].id == 'contenteditable-root'
31+
)
32+
2833
document.querySelector('.ytp-fullscreen-button').addEventListener("click", e => {
2934
fastToggleFullScreen()
3035
})
3136

3237
document.addEventListener("keydown", e => {
33-
if (e.code == 'KeyF') {
38+
if (e.code == 'KeyF' && !isWritingText(e)) {
39+
console.log(e)
3440
fastToggleFullScreen()
3541
}
3642
})

0 commit comments

Comments
 (0)