Skip to content

Commit bc59cd2

Browse files
committed
fix: reduce tooltip delay to 3s and only reset timer on button change
1 parent 476caed commit bc59cd2

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

public/js/app.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ function initSidebarTooltip() {
557557
const tooltip = document.getElementById('sidebar-tooltip');
558558
let tooltipTimer = null;
559559
let tooltipQuickMode = false;
560+
let currentItem = null;
560561

561562
function showTooltipForItem(item) {
562563
const text = item.textContent.trim();
@@ -572,22 +573,26 @@ function initSidebarTooltip() {
572573
tooltip.classList.remove('visible');
573574
clearTimeout(tooltipTimer);
574575
tooltipQuickMode = false;
576+
currentItem = null;
575577
}
576578

577579
sidebarNav.addEventListener('mouseover', (e) => {
578580
const item = e.target.closest('.nav-item');
579581
if (!item) return;
580582
if (!sidebar.classList.contains('collapsed')) return;
581583

582-
clearTimeout(tooltipTimer);
584+
if (item !== currentItem) {
585+
clearTimeout(tooltipTimer);
586+
currentItem = item;
583587

584-
if (tooltipQuickMode) {
585-
showTooltipForItem(item);
586-
} else {
587-
tooltipTimer = setTimeout(() => {
588+
if (tooltipQuickMode) {
588589
showTooltipForItem(item);
589-
tooltipQuickMode = true;
590-
}, 5000);
590+
} else {
591+
tooltipTimer = setTimeout(() => {
592+
showTooltipForItem(item);
593+
tooltipQuickMode = true;
594+
}, 3000);
595+
}
591596
}
592597
});
593598

0 commit comments

Comments
 (0)