From f21f27321879e7862d711afd0aa136648e3a8fd5 Mon Sep 17 00:00:00 2001 From: Jerrysmd <0x004c2@gmail.com> Date: Mon, 16 Oct 2023 07:56:08 +0800 Subject: [PATCH] Fix cursor visibility issue in mobile mode --- assets/js/theme.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/theme.js b/assets/js/theme.js index 030f8165e..ff5deb477 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -189,7 +189,10 @@ function initSearch () { window._searchMobileOnce = true // Turn on the mask when clicking on the search button searchInput.addEventListener('focus', () => { - loadScript('autocomplete-script', '/lib/autocomplete/autocomplete.min.js', () => initAutosearch()) + loadScript('autocomplete-script', '/lib/autocomplete/autocomplete.min.js', () => { + initAutosearch(); + searchInput.focus(); + }) if (window.config?.search?.type === 'algolia') { loadScript('algolia-script', '/lib/algoliasearch/algoliasearch-lite.umd.min.js', null) } else { @@ -197,6 +200,7 @@ function initSearch () { } document.body.classList.add('blur') header.classList.add('open') + searchInput.focus() }) // Turn off the everything when clicking on the cancel button document.getElementById('search-cancel-mobile').addEventListener('click', () => {