Fix login "enter" key behavior, per oruga
This commit is contained in:
		
							parent
							
								
									e4c4259674
								
							
						
					
					
						commit
						3d319cbd09
					
				
					 3 changed files with 16 additions and 5 deletions
				
			
		|  | @ -60,11 +60,19 @@ | |||
| <%def name="modify_this_page_vars()"> | ||||
|   <script type="text/javascript"> | ||||
| 
 | ||||
|     TailboneForm.mounted = function() { | ||||
|     ${form.component_studly}Data.usernameInput = null | ||||
| 
 | ||||
|     ${form.component_studly}.mounted = function() { | ||||
|         this.$refs.username.focus() | ||||
|         this.usernameInput = this.$refs.username.$el.querySelector('input') | ||||
|         this.usernameInput.addEventListener('keydown', this.usernameKeydown) | ||||
|     } | ||||
| 
 | ||||
|     TailboneForm.methods.usernameKeydown = function(event) { | ||||
|     ${form.component_studly}.beforeDestroy = function() { | ||||
|         this.usernameInput.removeEventListener('keydown', this.usernameKeydown) | ||||
|     } | ||||
| 
 | ||||
|     ${form.component_studly}.methods.usernameKeydown = function(event) { | ||||
|         if (event.which == 13) { | ||||
|             event.preventDefault() | ||||
|             this.$refs.password.focus() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar