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.

popover_menus: Fix tippy `instance` being undefined.

Aman Agrawald14b1b1085cc
diff --git a/web/src/popover_menus.ts b/web/src/popover_menus.ts
index 90442d44915..ae8adf7f409 100644
--- a/web/src/popover_menus.ts
+++ b/web/src/popover_menus.ts
@@ -212,8 +212,10 @@ export const default_popover_props: Partial<tippy.Props> = {
phase: "beforeWrite",
requires: ["$$tippy"],
fn({state}) {
+ // Since the reference element can be removed from DOM, we rely on popper
+ // here to access the tippy instance which is reliable.
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
- const instance = (state.elements.reference as tippy.ReferenceElement)._tippy!;
+ const instance = (state.elements.popper as tippy.PopperElement)._tippy!;
const $popover = $(state.elements.popper);
const $tippy_box = $popover.find(".tippy-box");
// $tippy_box[0].hasAttribute("data-reference-hidden"); is the real check