From 20e53537b1d0d445e395d4e3c93f82004b94c444 Mon Sep 17 00:00:00 2001 From: Tanner Date: Sun, 8 Nov 2026 17:27:31 +0000 Subject: [PATCH] Fix web dashboard bug where tooltip would move on click --- web_interface/src/dashboard.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web_interface/src/dashboard.js b/web_interface/src/dashboard.js index fe6d362..cf7b9b0 100644 --- a/web_interface/src/dashboard.js +++ b/web_interface/src/dashboard.js @@ -6,6 +6,7 @@ let itemNames = {}; let lastInventorySignature = ''; let lastState = null; + let lastInputMethod = 'pointer'; let selectedInventoryItem = null; let menuAnchor = null; let toastTimer = null; @@ -527,7 +528,7 @@ }); inventoryGrid.addEventListener('focusin', (event) => { const slot = event.target.closest('.inventory-slot.interactive'); - if (!slot) return; + if (!slot || lastInputMethod !== 'keyboard') return; const rect = slot.getBoundingClientRect(); showItemTooltip(slot, {x: rect.right, y: rect.top}); }); @@ -548,6 +549,13 @@ openInventoryMenu(slot); }); + document.addEventListener('pointerdown', () => { + lastInputMethod = 'pointer'; + }, true); + document.addEventListener('keydown', () => { + lastInputMethod = 'keyboard'; + }, true); + $('inventory-menu').addEventListener('click', (event) => { const button = event.target.closest('button[data-inventory-action]'); if (!button || button.disabled) return;