mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	user status: Save status on enter keypress.
This is a common UX pattern for forms - a user would expect the input to be submitted on hitting enter. So, create a 'keypress' event listener on the input field for the new status, which calls 'submit_new_status' on enter key press.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							40a6602b09
						
					
				
				
					commit
					043b55b5af
				
			@@ -82,6 +82,14 @@ exports.initialize = function () {
 | 
				
			|||||||
        exports.submit_new_status();
 | 
					        exports.submit_new_status();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $('body').on('keypress', '.user_status_overlay .user_status', function (event) {
 | 
				
			||||||
 | 
					        if (event.key === 'Enter') {
 | 
				
			||||||
 | 
					            event.preventDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            exports.submit_new_status();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $('body').on('keyup', '.user_status_overlay input.user_status', function () {
 | 
					    $('body').on('keyup', '.user_status_overlay input.user_status', function () {
 | 
				
			||||||
        exports.update_button();
 | 
					        exports.update_button();
 | 
				
			||||||
        exports.toggle_clear_message_button();
 | 
					        exports.toggle_clear_message_button();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user