mirror of https://github.com/zulip/zulip.git
custom_profile_fields: Fix multiple modals opening.
Earlier the focus remained on the button to open the modal, causing multiple modals to open on pressing enter repeatedly. This commit fixes the issue by removing the focus from the button by focusing on the first input field of the modal.
This commit is contained in:
parent
55884b1338
commit
fe557bde77
|
@ -22,6 +22,7 @@ import type {CustomProfileField} from "./state_data";
|
|||
import {current_user, realm} from "./state_data";
|
||||
import type {HTMLSelectOneElement, UserExternalAccountData} from "./types";
|
||||
import * as ui_report from "./ui_report";
|
||||
import {place_caret_at_end} from "./ui_util";
|
||||
|
||||
type FieldChoice = {
|
||||
value: string;
|
||||
|
@ -280,6 +281,9 @@ function open_custom_profile_field_form_modal(): void {
|
|||
on_click: create_profile_field,
|
||||
post_render: set_up_form_fields,
|
||||
loading_spinner: true,
|
||||
on_shown() {
|
||||
$("#profile_field_type").trigger("focus");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -572,6 +576,9 @@ function open_edit_form_modal(this: HTMLElement): void {
|
|||
on_click: submit_form,
|
||||
post_render: set_initial_values_of_profile_field,
|
||||
loading_spinner: true,
|
||||
on_shown() {
|
||||
place_caret_at_end($("#id-custom-profile-field-name")[0]!);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue