Skip targets tab auto-refresh while color picker is open

The 2-second auto-refresh was destroying the DOM and closing the
native color picker popup. Now checks if an input inside the targets
panel is focused before refreshing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 00:13:15 +03:00
parent 390f71ebae
commit aa57ce763a

View File

@@ -42,6 +42,9 @@ export function startAutoRefresh() {
if (apiKey) {
const activeTab = localStorage.getItem('activeTab') || 'dashboard';
if (activeTab === 'targets') {
// Skip refresh while user interacts with a picker or slider
const panel = document.getElementById('targets-panel-content');
if (panel && panel.contains(document.activeElement) && document.activeElement.matches('input')) return;
if (typeof window.loadTargetsTab === 'function') window.loadTargetsTab();
} else if (activeTab === 'dashboard') {
if (typeof window.loadDashboard === 'function') window.loadDashboard();