diff --git a/web/src/lib/components/elements/buttons/circle-icon-button.svelte b/web/src/lib/components/elements/buttons/circle-icon-button.svelte index 8af3f75ade..86782b6f44 100644 --- a/web/src/lib/components/elements/buttons/circle-icon-button.svelte +++ b/web/src/lib/components/elements/buttons/circle-icon-button.svelte @@ -31,6 +31,9 @@ togglePopover(true)} + on:mouseleave={() => togglePopover(false)} + on:focus={() => togglePopover(true)} + on:blur={() => togglePopover(false)} on:click {...$$restProps} > - + +{#if showPopover} +
+ {title} +
+{/if} diff --git a/web/src/lib/utils/popover-timer.ts b/web/src/lib/utils/popover-timer.ts new file mode 100644 index 0000000000..046375263c --- /dev/null +++ b/web/src/lib/utils/popover-timer.ts @@ -0,0 +1,15 @@ +let _hoverMode = false; +let timeoutId: ReturnType | undefined; +const hoverDelay = 600; +const getHoverMode = () => _hoverMode; +const setHoverMode = (mode: boolean) => { + if (mode) { + clearTimeout(timeoutId); + _hoverMode = true; + return; + } + timeoutId = setTimeout(() => { + _hoverMode = false; + }, hoverDelay); +}; +export { getHoverMode, hoverDelay, setHoverMode };