typeahead: Fix thin blue line bug when there is space after >.

When the user added space/s right after the topic typehead symbol `>`,
a thin blue line would be selected at the top of the typeahead menu.

To avoid this and to make stream and topic typeaheads' behaviour more
consistent with each other, space/s right after `>` is not allowed,
like it is not allowed right after `#`.

Fixes: #19124.
This commit is contained in:
N-Shar-ma
2022-08-12 21:08:58 +05:30
committed by Tim Abbott
parent aa700ff59d
commit cfa4973441

View File

@@ -723,6 +723,12 @@ export function get_candidates(query) {
if (tokens[1]) {
const stream_name = tokens[1];
this.token = tokens[2] || "";
// Don't autocomplete if there is a space following '>'
if (this.token[0] === " ") {
return false;
}
const topic_list = topics_seen_for(stream_name);
if (should_show_custom_query(this.token, topic_list)) {
topic_list.push(this.token);