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.

user_group_settings: Focus on an edit modal field when opened.

PieterCKa2871c9ddaa0
diff --git a/web/src/user_group_edit.ts b/web/src/user_group_edit.ts
index 0c9fe4f1f43..ae5277344ae 100644
--- a/web/src/user_group_edit.ts
+++ b/web/src/user_group_edit.ts
@@ -57,6 +57,7 @@ import type {StreamSubscription} from "./sub_store.ts";
import * as timerender from "./timerender.ts";
import {anonymous_group_schema, group_setting_value_schema} from "./types.ts";
import * as ui_report from "./ui_report.ts";
+import {place_caret_at_end} from "./ui_util.ts";
import * as user_group_components from "./user_group_components.ts";
import * as user_group_create from "./user_group_create.ts";
import * as user_group_edit_members from "./user_group_edit_members.ts";
@@ -2085,6 +2086,7 @@ export function initialize(): void {
function (this: HTMLElement, e) {
e.preventDefault();
e.stopPropagation();
+ const open_modal_button_id = $(this).attr("id");
const user_group_id = get_user_group_id(this);
const user_group = user_groups.get_user_group_from_id(user_group_id);
const template_data = {
@@ -2108,6 +2110,20 @@ export function initialize(): void {
.addClass("save-button")
.attr("data-group-id", user_group_id);
},
+ on_shown() {
+ let $input;
+ switch (open_modal_button_id) {
+ case "group_title_open_group_info_modal":
+ $input = $("#change_user_group_name");
+ break;
+ case "open_group_info_modal":
+ $input = $("#change_user_group_description");
+ break;
+ }
+ if ($input) {
+ place_caret_at_end(util.the($input));
+ }
+ },
update_submit_disabled_state_on_change: true,
});
},