Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
inbox, recent: Keep action buttons visible while menu open.
Alya Abbottdead3a4dd731
diff --git a/web/src/stream_popover.ts b/web/src/stream_popover.tsindex 584377c7053..f0160391881 100644--- a/web/src/stream_popover.ts+++ b/web/src/stream_popover.ts@@ -82,6 +82,12 @@ export function elem_to_stream_id($elem: JQuery): number {export function hide_stream_popover(instance: tippy.Instance): void {ui_util.hide_left_sidebar_menu_icon();+ if (instance.reference instanceof HTMLElement) {+ const $trigger = $(instance.reference).closest(".inbox-action-button");+ if ($trigger.length === 1) {+ $trigger.removeClass("topic-popover-visible");+ }+ }instance.destroy();popover_menus.popover_instances.stream_actions_popover = null;}@@ -164,6 +170,14 @@ function build_stream_popover(opts: {elt: HTMLElement; stream_id: number}): voidpopover_menus.popover_instances.stream_actions_popover = instance;ui_util.show_left_sidebar_menu_icon(elt);+ // Keep an inbox channel-header action button visible+ // while its stream popover is open, same way+ // topic_popover.ts does for topic rows.+ const $trigger = $(instance.reference).closest(".inbox-action-button");+ if ($trigger.length === 1) {+ $trigger.addClass("topic-popover-visible");+ }+// Go to channel feed instead of first topic.$popper.on("click", ".stream-popover-go-to-channel-feed", (e) => {e.preventDefault();diff --git a/web/src/topic_popover.ts b/web/src/topic_popover.tsindex 670d0dfc959..74c9ee8f5f3 100644--- a/web/src/topic_popover.ts+++ b/web/src/topic_popover.ts@@ -114,9 +114,11 @@ export function initialize(): void {const topic_display_name = context.topic_display_name;const is_empty_string_topic = context.is_empty_string_topic;- const $elt = $(instance.reference).closest(".recent_view_focusable");- if ($elt.length === 1) {- $elt.addClass("topic-popover-visible");+ const $popover_trigger = $(instance.reference).closest(+ ".recent_view_focusable, .inbox-action-button",+ );+ if ($popover_trigger.length === 1) {+ $popover_trigger.addClass("topic-popover-visible");}if (!stream_id) {@@ -261,9 +263,11 @@ export function initialize(): void {);},onHidden(instance) {- const $elt = $(instance.reference).closest(".recent_view_focusable");- if ($elt.length === 1) {- $elt.removeClass("topic-popover-visible");+ const $popover_trigger = $(instance.reference).closest(+ ".recent_view_focusable, .inbox-action-button",+ );+ if ($popover_trigger.length === 1) {+ $popover_trigger.removeClass("topic-popover-visible");}instance.destroy();popover_menus.popover_instances.topics_menu = null;diff --git a/web/styles/inbox.css b/web/styles/inbox.cssindex f7983b7d316..7b81c9875d4 100644--- a/web/styles/inbox.css+++ b/web/styles/inbox.css@@ -389,10 +389,21 @@.inbox-row-visibility-policy-inherit {opacity: 0;+ }- &.visibility-policy-popover-visible {- opacity: 1;- }+ /* Stickiness: while a marker or action button has its popover+ open, keep it in the direct-interaction tier (0.7) so the+ user can see which element the open menu belongs to.+ Substring match on `*-popover-visible` covers every class+ the popover JS toggles — `topic-popover-visible` (added by+ `topic_popover.ts` and `stream_popover.ts` on+ `.inbox-action-button`) and `visibility-policy-popover-visible`+ (added by `user_topic_popover.ts` on the visibility-policy+ wrappers) — without enumerating element/class combinations,+ and stays correct if a future popover follows the same+ naming convention. */+ [class*="-popover-visible"] {+ opacity: 0.7;}.inbox-action-button {