tooltip: Hide scroll button tooltip on transition.

Fix a bug where the tooltip for the scroll
to bottom button would remain visible after the
button disapeared, if the user was hovering over
the button as it was dissapearing, without moving
their mouse. Now, the tooltip dissapears when
the button finishes the visibility transition.

Fixes #28656
This commit is contained in:
Tudor Stefan Pagu 2024-03-09 16:56:55 +01:00 committed by Tim Abbott
parent 631aa1aac5
commit 3324721eb7
1 changed files with 14 additions and 0 deletions

View File

@ -177,4 +177,18 @@ export function initialize() {
} }
} }
}); });
const $show_scroll_to_bottom_button = $("#scroll-to-bottom-button-container").expectOne();
// Delete the tippy tooltip whenever the fadeout animation for
// this button is finished. This is necessary because the fading animation
// confuses Tippy's built-in `data-reference-hidden` feature.
$show_scroll_to_bottom_button.on("transitionend", (e) => {
if (e.propertyName === "visibility") {
const tooltip = $("#scroll-to-bottom-button-clickable-area")[0]._tippy;
// make sure the tooltip exists and the class is not currently showing
if (tooltip && !$show_scroll_to_bottom_button.hasClass("show")) {
tooltip.destroy();
}
}
});
} }