Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
saved_snippets: Don't highlight current_value.
Shubham Padia97ead9bf8f2d
diff --git a/web/src/dropdown_widget.ts b/web/src/dropdown_widget.tsindex 5032729a82f..58eaab4ec04 100644--- a/web/src/dropdown_widget.ts+++ b/web/src/dropdown_widget.ts@@ -79,6 +79,7 @@ export type DropdownWidgetOptions = {// NOTE: Any value other than `undefined` will be rendered when class is initialized.default_id?: string | number | undefined;unique_id_type?: DataType;+ highlight_current_value?: boolean;// Text to show if the current value is not in `get_options()`.text_if_current_value_not_in_options?: string;hide_search_box?: boolean;@@ -123,6 +124,7 @@ export class DropdownWidget {default_id: string | number | undefined;current_value: string | number | undefined;unique_id_type: DataType | undefined;+ highlight_current_value: boolean;$events_container: JQuery;text_if_current_value_not_in_options: string;// Effective value used while dropdown is open.@@ -168,6 +170,7 @@ export class DropdownWidget {this.default_id = options.default_id;this.current_value = this.default_id;this.unique_id_type = options.unique_id_type;+ this.highlight_current_value = options.highlight_current_value ?? true;this.$events_container = options.$events_container;this.text_if_current_value_not_in_options =options.text_if_current_value_not_in_options ?? "";@@ -376,6 +379,7 @@ export class DropdownWidget {}const selected_item_unique_id = this.current_value;+ const highlight_current_value = this.highlight_current_value;this.list_widget = ListWidget.create($dropdown_list_body,@@ -387,7 +391,9 @@ export class DropdownWidget {return render_dropdown_list({item: {...item,- is_current_user_setting:+ highlight_value:+ highlight_current_value &&+ // Checks if the current item is current_value.item.unique_id === selected_item_unique_id,},});diff --git a/web/src/saved_snippets_ui.ts b/web/src/saved_snippets_ui.tsindex 0f66713583f..70eba177ee7 100644--- a/web/src/saved_snippets_ui.ts+++ b/web/src/saved_snippets_ui.ts@@ -207,6 +207,7 @@ export function setup_saved_snippets_dropdown_widget(widget_selector: string): v$events_container: $("body"),unique_id_type: "number",hide_search_box_focus_first_item_on_keyboard_open: true,+ highlight_current_value: false,sticky_bottom_option: $t({defaultMessage: "Create a new saved snippet",}),diff --git a/web/styles/zulip.css b/web/styles/zulip.cssindex 99667aa1ff5..bf720bca0b4 100644--- a/web/styles/zulip.css+++ b/web/styles/zulip.css@@ -2374,7 +2374,7 @@ body:not(.spectator-view) {--background-color-current-selection-dropdown-item);- &:not(.current_user_setting):hover {+ &:not(.highlight_value):hover {background-color: transparent;}}@@ -2396,7 +2396,7 @@ body:not(.spectator-view) {border-radius: 4px;}- &.current_user_setting {+ &.highlight_value {background-color: var(--background-color-current-setting-dropdown-item);diff --git a/web/templates/dropdown_list.hbs b/web/templates/dropdown_list.hbsindex 9e43ec36835..abac5c75366 100644--- a/web/templates/dropdown_list.hbs+++ b/web/templates/dropdown_list.hbs@@ -1,5 +1,5 @@{{#with item}}- <li class="list-item {{#if is_current_user_setting}}current_user_setting{{/if}}" role="presentation" data-unique-id="{{unique_id}}" data-name="{{name}}" tabindex="0">+ <li class="list-item {{#if highlight_value}}highlight_value{{/if}}" role="presentation" data-unique-id="{{unique_id}}" data-name="{{name}}" tabindex="0">{{#if description}}<a class="dropdown-list-item-common-styles"><span class="dropdown-list-item-name">