forked from MapComplete/MapComplete
		
	Add 'ctrl+F' to select the search box immediately
This commit is contained in:
		
							parent
							
								
									8f51dd8d64
								
							
						
					
					
						commit
						92b311bffa
					
				
					 3 changed files with 22 additions and 10 deletions
				
			
		|  | @ -238,11 +238,18 @@ export default class DefaultGUI { | |||
|             .AttachTo("on-small-screen") | ||||
| 
 | ||||
|         new Combine([ | ||||
|             Toggle.If(state.featureSwitchSearch, () => | ||||
|                 new SearchAndGo(state).SetClass( | ||||
|             Toggle.If(state.featureSwitchSearch, () => { | ||||
|                 const search = new SearchAndGo(state).SetClass( | ||||
|                     "shadow rounded-full h-min w-full overflow-hidden sm:max-w-sm pointer-events-auto" | ||||
|                 ) | ||||
|             ), | ||||
|                 document.addEventListener("keydown", function (event) { | ||||
|                     if (event.ctrlKey && event.code === "KeyF") { | ||||
|                         search.focus() | ||||
|                         event.preventDefault() | ||||
|                     } | ||||
|                 }) | ||||
|                 return search | ||||
|             }), | ||||
|         ]).AttachTo("top-right") | ||||
| 
 | ||||
|         new LeftControls(state, guiState).AttachTo("bottom-left") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue