@@ -6061,12 +6061,6 @@ export class LGraphCanvas implements ConnectionColorContext {
60616061 const canvas = graphcanvas . canvas
60626062 const root_document = canvas . ownerDocument || document
60636063
6064- const input = Object . assign ( document . createElement ( "input" ) , {
6065- autofocus : true ,
6066- type : "text" ,
6067- className : "value rounded" ,
6068- } satisfies Partial < HTMLInputElement > )
6069-
60706064 const div = document . createElement ( "div" )
60716065 const dialog = Object . assign ( div , {
60726066 close ( this : typeof div ) {
@@ -6076,14 +6070,12 @@ export class LGraphCanvas implements ConnectionColorContext {
60766070 root_document . body . style . overflow = ""
60776071
60786072 // important, if canvas loses focus keys wont be captured
6079- setTimeout ( canvas . focus , 20 )
6073+ setTimeout ( ( ) => canvas . focus ( ) , 20 )
60806074 dialog . remove ( )
60816075 } ,
60826076 } satisfies Partial < HTMLDivElement > & ICloseable )
60836077 dialog . className = "litegraph litesearchbox graphdialog rounded"
6084- dialog . innerHTML = "<span class='name'>Search</span> "
6085- dialog . append ( input )
6086-
6078+ dialog . innerHTML = "<span class='name'>Search</span> <input autofocus type='text' class='value rounded'/>"
60876079 if ( options . do_type_filter ) {
60886080 dialog . innerHTML += "<select class='slot_in_type_filter'><option value=''></option></select>"
60896081 dialog . innerHTML += "<select class='slot_out_type_filter'><option value=''></option></select>"
@@ -6163,6 +6155,11 @@ export class LGraphCanvas implements ConnectionColorContext {
61636155 let timeout : ReturnType < typeof setTimeout > | null = null
61646156 let selected : ChildNode | null = null
61656157
6158+ const maybeInput = dialog . querySelector ( "input" )
6159+ if ( ! maybeInput ) throw new TypeError ( "Could not create search input box." )
6160+
6161+ const input = maybeInput
6162+
61666163 if ( input ) {
61676164 input . addEventListener ( "blur" , function ( ) {
61686165 this . focus ( )
0 commit comments