From 4413387b382b91a6e31c5fef4ef1edeaa6650e53 Mon Sep 17 00:00:00 2001 From: vdbhb59 Date: Sat, 20 Dec 2025 17:02:55 +0530 Subject: [PATCH] Fixed search on mobile/tablet devices Fixed a research (second search query) not working on mobile & tablet devices. Also, ensured a blank search gives alert. --- static/client.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/static/client.js b/static/client.js index 5935f92..3206eff 100644 --- a/static/client.js +++ b/static/client.js @@ -694,10 +694,21 @@ if(searchbox_wrapper.length !== 0){ /* Textarea shortcuts */ + // Auto submit on enter for touch devices + const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; + if(isTouchDevice) { + document.addEventListener("change", function(key){ + if(searchbox.value !== ""){ + submit(form); + } else { + alert("Please fill out the search query."); + searchbox.focus(); + } + }) + }; + document.addEventListener("keydown", function(key){ - switch(key.keyCode){ - case 191: // 191 = / if(document.activeElement.tagName == "INPUT"){