Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

tooltip: Fix .status-emoji-name tooltip stuck on typeahead enter.

Pratik Chandab815a0d182cd
diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.ts
index a33f485a83f..4072cbf74f2 100644
--- a/web/src/bootstrap_typeahead.ts
+++ b/web/src/bootstrap_typeahead.ts
@@ -469,6 +469,10 @@ export class Typeahead<ItemType extends string | object> {
void instance.popperInstance?.update();
});
},
+ onHidden: (instance) => {
+ this.clear_typeahead_tooltip?.();
+ instance.destroy();
+ },
});
}
@@ -571,6 +575,9 @@ export class Typeahead<ItemType extends string | object> {
// footer might change depending on whether next character is
// `_` (silent mention) or not.
const footer_text_html = this.footer_html();
+ // We want to clear tooltip instance on each re render since
+ // emoji may have shifted its position.
+ this.clear_typeahead_tooltip?.();
if (footer_text_html) {
this.$footer.find("span#typeahead-footer-text").html(footer_text_html);
diff --git a/web/src/composebox_typeahead.ts b/web/src/composebox_typeahead.ts
index dd3498db046..d16ba5e9831 100644
--- a/web/src/composebox_typeahead.ts
+++ b/web/src/composebox_typeahead.ts
@@ -31,6 +31,7 @@ import * as stream_topic_history from "./stream_topic_history.ts";
import * as stream_topic_history_util from "./stream_topic_history_util.ts";
import type * as sub_store from "./sub_store.ts";
import * as timerender from "./timerender.ts";
+import * as tippyjs from "./tippyjs.ts";
import * as topic_link_util from "./topic_link_util.ts";
import type {Emoji, EmojiSuggestion} from "./typeahead.ts";
import * as typeahead from "./typeahead.ts";
@@ -1516,6 +1517,9 @@ export function initialize_compose_typeahead($element: JQuery<HTMLTextAreaElemen
? "topic-typeahead-link"
: "";
},
+ clear_typeahead_tooltip() {
+ tippyjs.typeahead_status_emoji_tooltip?.hide();
+ },
}),
);
}
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index 78b3bbcb3f6..71ebbe8bb73 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -92,6 +92,8 @@ tippy.default.setDefaultProps({
content: get_tooltip_content,
});
+export let typeahead_status_emoji_tooltip: tippy.Instance | undefined;
+
export const topic_visibility_policy_tooltip_props = {
delay: LONG_HOVER_DELAY,
appendTo: () => document.body,
@@ -657,8 +659,12 @@ export function initialize(): void {
separately handle emoji instance.
*/
+ onShow(instance) {
+ typeahead_status_emoji_tooltip = instance;
+ },
onHidden(instance) {
instance.destroy();
+ typeahead_status_emoji_tooltip = undefined;
},
});