Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent_view: Fix filter dropdown enabled after search for spectators.
Aman Agrawal7997af675b89
diff --git a/web/src/dropdown_widget.js b/web/src/dropdown_widget.jsindex d100b767a91..638cd7f4637 100644--- a/web/src/dropdown_widget.js+++ b/web/src/dropdown_widget.js@@ -77,6 +77,10 @@ export class DropdownWidget {}init() {+ // NOTE: Widget should only be initialized again if the events_container was rendered again to+ // avoid duplicate events to be attached to events_container.+ // Don't attach any events or classes to any element other than `events_container` here, otherwise+ // the attached events / classes will be lost when the widget is rendered again without initialing the widget again.if (this.current_value !== null) {this.render();}@@ -94,12 +98,15 @@ export class DropdownWidget {);if (this.disable_for_spectators && page_params.is_spectator) {- const $widget = $(this.widget_id);- $widget.addClass("disabled-for-spectators");- $widget.on("click", (e) => {- e.stopPropagation();- e.preventDefault();- });+ this.$events_container.addClass("dropdown-widget-disabled-for-spectators");+ this.$events_container.on(+ "click",+ `${this.widget_id}, ${this.widget_wrapper_id}`,+ (e) => {+ e.stopPropagation();+ e.preventDefault();+ },+ );}}diff --git a/web/styles/recent_view.css b/web/styles/recent_view.cssindex cca4f84c4e2..a9df2a96f80 100644--- a/web/styles/recent_view.css+++ b/web/styles/recent_view.css@@ -558,7 +558,7 @@}}-#recent-view-filter_widget.disabled-for-spectators {+.dropdown-widget-disabled-for-spectators #recent-view-filter_widget {cursor: not-allowed;opacity: 0.5;}