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:
Divyanshu Agrawal 2020-03-05 14:38:27 +05:30 committed by Tim Abbott
parent 40a6602b09
commit 043b55b5af
1 changed files with 8 additions and 0 deletions

View File

@ -82,6 +82,14 @@ exports.initialize = function () {
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 () {
exports.update_button();
exports.toggle_clear_message_button();