fix(ui): actionable toasts linger, and a dead hotkey shows in the sidebar
Every toast auto-dismissed after 2.8 s — fine for a success receipt, too short to read AND act on an error. Errors and warnings now stay 10 s and can be clicked away; success is unchanged. The hotkey-conflict warning also needed a trace outside the toast: the ⚠ in Settings only helps someone who opens the panel. A dot on the sidebar Settings entry (plus a tooltip) is now the cue in the main UI that a combo is dead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,17 @@ function renderHotkeyConflicts() {
|
||||
'the hotkey does nothing. Pick another one.';
|
||||
else btn.removeAttribute('title');
|
||||
}
|
||||
// Dot on the Settings button: the ⚠ inside the panel only helps someone who
|
||||
// opens it, and the toast may well have been missed. This is the only cue
|
||||
// left in the main UI that a hotkey is silently dead.
|
||||
const gear = document.getElementById('settingsBtn');
|
||||
if (gear) {
|
||||
gear.classList.toggle('has-alert', bad.size > 0);
|
||||
if (bad.size > 0)
|
||||
gear.title = 'A hotkey combo is already used by another app — see Autofill settings';
|
||||
else if (gear.title.startsWith('A hotkey combo'))
|
||||
gear.title = 'Settings';
|
||||
}
|
||||
}
|
||||
|
||||
// Format a combo for human display: "Ctrl+Shift+L".
|
||||
|
||||
@@ -1016,7 +1016,16 @@ function toast(msg, type) {
|
||||
t.className = 'toast is-' + type;
|
||||
t.textContent = msg;
|
||||
container.appendChild(t);
|
||||
setTimeout(() => t.remove(), 2800);
|
||||
// A success toast is a receipt — 2.8 s is plenty. An error or warning is
|
||||
// something the user has to READ and usually act on, and 2.8 s isn't
|
||||
// enough for either, so those linger and can be clicked away early.
|
||||
const actionable = (type === 'error' || type === 'warning');
|
||||
if (actionable) {
|
||||
t.classList.add('is-dismissable');
|
||||
t.title = 'Click to dismiss';
|
||||
t.addEventListener('click', () => t.remove());
|
||||
}
|
||||
setTimeout(() => t.remove(), actionable ? 10000 : 2800);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user