Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

custom_profile_fields: Fix multiple modals opening.

Kenneth Rodriguesfe557bde77cb
diff --git a/web/src/settings_profile_fields.ts b/web/src/settings_profile_fields.ts
index d5b0cc18f52..5a45708a7c7 100644
--- a/web/src/settings_profile_fields.ts
+++ b/web/src/settings_profile_fields.ts
@@ -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]!);
+ },
});
}