aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
authorBuildTools <unconfigured@null.spigotmc.org>2016-12-06 19:58:09 +0100
committerBuildTools <unconfigured@null.spigotmc.org>2016-12-06 19:58:09 +0100
commit9edbbfc1057235194249112f032e450c938c2e68 (patch)
treee5f215bf21799101c3a575a72d0fccc1ccfce0fa /public/javascripts/main.js
parent2e9a1e4bbb20b44bbd3416be2f2bfafbfca8dacf (diff)
fix bug not properly removing selection
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) {