mirror of https://github.com/zulip/zulip.git
left_sidebar: Show tooltip only for truncated channel names.
This commit replaces the default HTML title attribute with a Tippy.js tooltip for channel names in the subscription block, ensuring that tooltips are shown only when the name is truncated. Fixes #31807.
This commit is contained in:
parent
c032bd9e78
commit
537efad959
|
@ -92,7 +92,6 @@ async function navigation_tests(page: Page): Promise<void> {
|
|||
await common.log_in(page);
|
||||
|
||||
await navigate_to_settings(page);
|
||||
|
||||
await navigate_using_left_sidebar(page, "Verona");
|
||||
|
||||
await page.click("#left-sidebar-navigation-list .home-link");
|
||||
|
|
|
@ -184,6 +184,24 @@ export function initialize(): void {
|
|||
},
|
||||
});
|
||||
|
||||
tippy.delegate("body", {
|
||||
target: ".subscription_block",
|
||||
trigger: "mouseenter",
|
||||
delay: LONG_HOVER_DELAY,
|
||||
placement: "right",
|
||||
appendTo: () => document.body,
|
||||
onShow(instance) {
|
||||
const stream_name = instance.reference.querySelector(".stream-name");
|
||||
assert(stream_name instanceof HTMLElement);
|
||||
if (stream_name.offsetWidth >= stream_name.scrollWidth) {
|
||||
return false;
|
||||
}
|
||||
const truncated_stream_name = stream_name.textContent ?? "";
|
||||
instance.setContent(truncated_stream_name);
|
||||
return undefined;
|
||||
},
|
||||
});
|
||||
|
||||
tippy.delegate("body", {
|
||||
target: ".tippy-left-sidebar-tooltip",
|
||||
placement: "right",
|
||||
|
|
Loading…
Reference in New Issue