aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r--public/javascripts/main.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 62bf3a2..f9cc0db 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -171,11 +171,12 @@ inputNode.addEventListener('click', function () {
inputNode.select()
})
-inputNode.addEventListener('blur', function () {
- const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
- if (!isSafari) {
- inputNode.selectionStart = inputNode.selectionEnd = -1
- }
+window.addEventListener('blur', function () {
+ // this will removed the selection without drawing focus on it (safari)
+ // this will removed selection even when focusing an iframe (chrome)
+ const oldValue = inputNode.value
+ inputNode.value = ''
+ inputNode.value = oldValue
})
searchNode.addEventListener('blur', function (e) {