From 8b1e21dab074d8b9feb6d051ef94b1c4d7090b57 Mon Sep 17 00:00:00 2001 From: inventivetalent Date: Fri, 26 Oct 2018 18:59:18 +0200 Subject: [PATCH] new search css & autofocus changes --- src/litegraph.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/litegraph.js b/src/litegraph.js index 774fa7d907..b7ed22a9b5 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -6663,7 +6663,7 @@ LGraphCanvas.prototype.showSearchBox = function(event) var input_html = ""; var dialog = document.createElement("div"); - dialog.className = "graphdialog rounded"; + dialog.className = "litegraph litesearchbox graphdialog rounded"; dialog.innerHTML = "Search
"; dialog.close = function() { @@ -6688,6 +6688,9 @@ LGraphCanvas.prototype.showSearchBox = function(event) var input = dialog.querySelector("input"); if(input) { + input.addEventListener("blur", function(e){ + this.focus(); + }); input.addEventListener("keydown", function(e){ if(e.keyCode == 38) //UP @@ -6741,7 +6744,7 @@ LGraphCanvas.prototype.showSearchBox = function(event) } canvas.parentNode.appendChild( dialog ); - setTimeout( function(){ input.focus(); },10 ); + input.focus(); function select( name ) { @@ -6800,7 +6803,7 @@ LGraphCanvas.prototype.showSearchBox = function(event) var help = document.createElement("div"); if(!first) first = i; help.innerText = i; - help.className = "help-item"; + help.className = "litegraph lite-search-item"; help.addEventListener("click", function(e){ select( this.innerText ); });