diff options
| author | Alexandre Flament <alex@al-f.net> | 2022-06-13 21:35:14 +0200 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2022-06-13 21:35:14 +0200 |
| commit | fe1683c9c6fae8ccd16049912a13d0bb527d0e62 (patch) | |
| tree | 249ec7ca8cceca237d2e1b2a55e8d0de2bb9eff8 /searx/static/themes/simple/src/js/main/keyboard.js | |
| parent | 9b0b6a2c90fa87a83bdff3ec646bbf200797c642 (diff) | |
UX fix: when the user clicks on the search input, don't move the cursor at the end
Related to https://github.com/searxng/searxng/pull/1153#issuecomment-1154247988
Diffstat (limited to 'searx/static/themes/simple/src/js/main/keyboard.js')
| -rw-r--r-- | searx/static/themes/simple/src/js/main/keyboard.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/static/themes/simple/src/js/main/keyboard.js b/searx/static/themes/simple/src/js/main/keyboard.js index f29ed86f4..0eb30b09f 100644 --- a/searx/static/themes/simple/src/js/main/keyboard.js +++ b/searx/static/themes/simple/src/js/main/keyboard.js @@ -317,7 +317,12 @@ searxng.ready(function () { function searchInputFocus () { window.scrollTo(0, 0); - document.querySelector('#q').focus(); + var q = document.querySelector('#q'); + q.focus(); + if (q.setSelectionRange) { + var len = q.value.length; + q.setSelectionRange(len, len); + } } function openResult (newTab) { |