mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
popover_menus: Fix tippy instance being undefined.
Since the reference element can be removed from DOM, we rely on `popper` here to access the tippy instance which is reliable.
This commit is contained in:
@@ -212,8 +212,10 @@ export const default_popover_props: Partial<tippy.Props> = {
|
|||||||
phase: "beforeWrite",
|
phase: "beforeWrite",
|
||||||
requires: ["$$tippy"],
|
requires: ["$$tippy"],
|
||||||
fn({state}) {
|
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
|
// 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 $popover = $(state.elements.popper);
|
||||||
const $tippy_box = $popover.find(".tippy-box");
|
const $tippy_box = $popover.find(".tippy-box");
|
||||||
// $tippy_box[0].hasAttribute("data-reference-hidden"); is the real check
|
// $tippy_box[0].hasAttribute("data-reference-hidden"); is the real check
|
||||||
|
|||||||
Reference in New Issue
Block a user