mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
tooltips: Use tippy to display tooltips.
Fixes: #27817 Co-Authored-By: linn.peterson <linn@pajp.net> Co-Authored-By: Aman Agrawal <amanagr@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
b6e2a1b50d
commit
d6146d77c1
@@ -136,6 +136,25 @@ export function initialize(): void {
|
||||
placement: "bottom",
|
||||
});
|
||||
|
||||
tippy.delegate("body", {
|
||||
target: "#subscription_overlay .subscription_settings .sub-stream-name",
|
||||
delay: LONG_HOVER_DELAY,
|
||||
appendTo: () => document.body,
|
||||
placement: "top",
|
||||
onShow(instance) {
|
||||
const stream_name_element = instance.reference;
|
||||
assert(stream_name_element instanceof HTMLElement);
|
||||
// Only show tooltip if the stream name is truncated.
|
||||
// See https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively
|
||||
// for more details.
|
||||
if (stream_name_element.offsetWidth >= stream_name_element.scrollWidth) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
});
|
||||
|
||||
tippy.delegate("body", {
|
||||
target: ".tippy-left-sidebar-tooltip",
|
||||
placement: "right",
|
||||
|
||||
Reference in New Issue
Block a user