Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.

Commit

Permalink
Fix auto-focus by delaying handling update 100ms
Browse files Browse the repository at this point in the history
Closes #12
  • Loading branch information
Opinion committed Nov 11, 2022
1 parent e549310 commit 4e4d44c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,15 @@ const HandlingEditor = {
// Creating event listener
const self = this
inputElement.addEventListener('change', () => {
self.recentlyUpdatedInputElement = inputElement
self.updateHandling(handlingKey, inputElement.value)

// Display saved text in UI
const savedElement = inputElement.parentElement.children[2]
savedElement?.classList?.add('active')
setTimeout(() => { savedElement?.classList?.remove('active') }, 2500)
setTimeout(() => {
self.recentlyUpdatedInputElement = inputElement
self.updateHandling(handlingKey, inputElement.value)

// Display saved text in UI
const savedElement = inputElement.parentElement.children[2]
savedElement?.classList?.add('active')
setTimeout(() => { savedElement?.classList?.remove('active') }, 2500)
}, 100)
})
}
}
Expand Down

0 comments on commit 4e4d44c

Please sign in to comment.