compose_recipient: Early return in on_hidden_callback if no item click.

Previously, the topic / direct message recipient input box was always
focused when the compose select recipient dropdown got closed, even if
the user clicked elsewhere. This resulted in unwanted trigger of
onFocus event listener etc.

This adds an early return to ensure focus updates only when an item
is clicked.
This commit is contained in:
Prakhar Pratyush
2025-02-25 11:03:55 +05:30
committed by Tim Abbott
parent 9a29320d61
commit 2b4d2f15f2
2 changed files with 17 additions and 3 deletions

View File

@@ -107,6 +107,10 @@ export class DropdownWidget {
dropdown_input_visible_selector: string;
prefer_top_start_placement: boolean;
// TODO: This is only used in one widget, with no implementation
// here, so should be generalized or reworked.
item_clicked = false;
constructor(options: DropdownWidgetOptions) {
this.widget_name = options.widget_name;
this.widget_selector = options.widget_selector ?? `#${CSS.escape(this.widget_name)}_widget`;