Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
actions_popover: Only wrap content to next line on small width.
Aman Agrawalab9c5ae4823f
diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.jsindex 0be010b4709..8e6d51c4587 100644--- a/frontend_tests/node_tests/popovers.js+++ b/frontend_tests/node_tests/popovers.js@@ -258,6 +258,7 @@ test_ui("actions_popover", ({override, mock_template}) => {};};+ mock_template("actions_popover_template.hbs", false, () => "actions-template");mock_template("actions_popover_content.hbs", false, (opts) => {// TODO: Test all the properties of the popoverassert.equal(diff --git a/static/js/popovers.js b/static/js/popovers.jsindex 7caa793ad02..6082d033a3d 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -5,6 +5,7 @@ import $ from "jquery";import tippy, {hideAll} from "tippy.js";import render_actions_popover_content from "../templates/actions_popover_content.hbs";+import render_actions_popover_template from "../templates/actions_popover_template.hbs";import render_no_arrow_popover from "../templates/no_arrow_popover.hbs";import render_playground_links_popover_content from "../templates/playground_links_popover_content.hbs";import render_remind_me_popover_content from "../templates/remind_me_popover_content.hbs";@@ -20,6 +21,7 @@ import * as compose_actions from "./compose_actions";import * as compose_state from "./compose_state";import * as compose_ui from "./compose_ui";import * as condense from "./condense";+import {media_breakpoints_num} from "./css_variables";import * as dialog_widget from "./dialog_widget";import * as emoji_picker from "./emoji_picker";import * as feature_flags from "./feature_flags";@@ -558,12 +560,19 @@ export function toggle_actions_popover(element, id) {placement: message_viewport.height() - ypos < 220 ? "top" : "bottom",title: "",content: render_actions_popover_content(args),+ template: render_actions_popover_template(),html: true,trigger: "manual",});$elt.popover("show");$current_actions_popover_elem = $elt;}++ if (window.innerWidth < media_breakpoints_num.xl) {+ // This ensures that the popover doesn't overflow to the right of the window.+ const actions_popover_left = window.innerWidth - $(".actions_popover_wrapper").outerWidth();+ $(".actions_popover_wrapper").css("left", actions_popover_left);+ }}export function render_actions_remind_popover(element, id) {diff --git a/static/styles/app_components.css b/static/styles/app_components.cssindex 867d0633ecf..9af7063d6ea 100644--- a/static/styles/app_components.css+++ b/static/styles/app_components.css@@ -48,6 +48,16 @@ kbd {}}+@media (width < $xl_min) {+ .hide-xl {+ display: none !important;+ }++ .show-xl {+ display: block !important;+ }+}+.light {font-weight: 300;}diff --git a/static/styles/popovers.css b/static/styles/popovers.cssindex c2988b52877..6eb3b11c491 100644--- a/static/styles/popovers.css+++ b/static/styles/popovers.css@@ -145,6 +145,20 @@ ul {}}+.actions_popover_wrapper {+ .arrow {+ position: absolute;+ }++ @media (width < $xl_min) {+ width: max-content;+ }++ @media (width <= $mm_min) {+ width: auto;+ }+}+.actions_popover {.mark_as_unread {.unread_count {diff --git a/static/templates/actions_popover_template.hbs b/static/templates/actions_popover_template.hbsnew file mode 100644index 00000000000..b67ed7a16d4--- /dev/null+++ b/static/templates/actions_popover_template.hbs@@ -0,0 +1,6 @@+<div class="popover actions_popover_wrapper">+ <div class="arrow hide-xl"></div>+ <div class="popover-content">+ <div></div>+ </div>+</div>diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex 55f1a93d13d..f57a3c224a3 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -71,7 +71,6 @@ EXEMPT_FILES = make_set("static/js/confirm_dialog.js","static/js/copy_and_paste.js","static/js/csrf.ts",- "static/js/css_variables.js","static/js/dark_theme.js","static/js/debug.js","static/js/deprecated_feature_notice.js",