(core) fixes hanging Save/Revert tooltips

Summary:
 - Clicking quickly on the small save/revert button was caussing the
 tooltip to stay around.
    - But if user waited a little bit before clicking the save button,
 the tooltip was shown, and then properly removed when the button was removed.

 - Code was missing propertly handling of disposal before the tooltip
   were shown.

Test Plan: Added test case to the projects/tooltip.ts tests

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2797
This commit is contained in:
Cyprien P 2021-05-04 09:39:17 +02:00
parent 18268d7838
commit a9d021af18

View File

@ -174,6 +174,9 @@ export function setHoverTooltip(refElem: Element, tipContent: ITooltipContentFun
// If request, re-open on click.
dom.onElem(refElem, 'click', () => { close(); open(); });
}
// close tooltip if refElem is disposed
dom.onDisposeElem(refElem, close);
}
/**