Merge pull request #60 from Serraniel/bugfix/#54-quick-search-hot-key-triggers-when-text-input-is-focused

#54 Avoid quick search hotkey if input is focused
This commit is contained in:
Daniel 2020-10-01 21:34:08 +02:00 committed by GitHub
commit 1786e56df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,12 @@ function handleQuickSearch(event) {
function handleSearchForShiftF(event) { function handleSearchForShiftF(event) {
if (helper.isShiftPressed) { if (helper.isShiftPressed) {
if (event.key === 'F') { // check if some kind of input is focused already; we then prevent our hotkey
if (document.activeElement instanceof HTMLInputElement || document.activeElement.isContentEditable) {
return;
}
if (event.code === 'KeyF') {
event.preventDefault(); event.preventDefault();
document.getElementById(quickSearchID).focus(); document.getElementById(quickSearchID).focus();
} }