compose: Focus on topic when narrowed to a stream+topic.

When narrowed to a stream+topic and clicking the "new topic" button,
focus in on topic and the text remains selected.
Fixes #3888.
This commit is contained in:
Raghav Jajodia
2017-03-05 19:17:00 +05:30
committed by Tim Abbott
parent b8341280e8
commit 21f0339cfc
2 changed files with 8 additions and 3 deletions

View File

@@ -336,7 +336,7 @@ $(function () {
$('.compose_stream_button').click(function () { $('.compose_stream_button').click(function () {
compose.start('stream'); compose.start('stream', {trigger: 'new topic button'});
}); });
$('.compose_private_button').click(function () { $('.compose_private_button').click(function () {
compose.start('private'); compose.start('private');

View File

@@ -264,8 +264,13 @@ exports.start = function (msg_type, opts) {
is_composing_message = msg_type; is_composing_message = msg_type;
// Show either stream/topic fields or "You and" field. // Set focus to "Topic" when narrowed to a stream+topic and "New topic" button clicked.
show_box_for_msg_type(msg_type, opts); if (opts.trigger === "new topic button") {
show_box('stream', $("#subject"), opts);
} else {
// Show either stream/topic fields or "You and" field.
show_box_for_msg_type(msg_type, opts);
}
compose_fade.start_compose(msg_type); compose_fade.start_compose(msg_type);