Fix web dashboard bug where tooltip would move on click

This commit is contained in:
Tanner
2026-11-08 17:27:31 +00:00
parent e290aa25fa
commit 20e53537b1
+9 -1
View File
@@ -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;