refactor: replace inline onclick with data-action event delegation
Lint / Python (flake8) (push) Successful in 42s
Lint / JS (eslint) (push) Successful in 8s
Security / Python Security (bandit) (push) Successful in 1m0s
Test / Python Tests (pytest) (push) Successful in 50s
Lint / Notify on failure (push) Has been skipped
Lint / Deploy (push) Successful in 2s
Lint / Python (flake8) (push) Successful in 42s
Lint / JS (eslint) (push) Successful in 8s
Security / Python Security (bandit) (push) Successful in 1m0s
Test / Python Tests (pytest) (push) Successful in 50s
Lint / Notify on failure (push) Has been skipped
Lint / Deploy (push) Successful in 2s
The command palette button used an inline onclick handler while every other interactive element in base.html uses data-action + event delegation. Now consistent: data-action="open-cmdpalette" handled in the global footer click listener. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-4
@@ -144,9 +144,9 @@
|
|||||||
<!-- ⌘K affordance -->
|
<!-- ⌘K affordance -->
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="lt-btn lt-btn-ghost lt-btn-sm lt-cmd-hint-btn"
|
class="lt-btn lt-btn-ghost lt-btn-sm lt-cmd-hint-btn"
|
||||||
|
data-action="open-cmdpalette"
|
||||||
title="Command palette (Ctrl+K)"
|
title="Command palette (Ctrl+K)"
|
||||||
aria-label="Open command palette"
|
aria-label="Open command palette">⌕ K</button>
|
||||||
onclick="if(window.lt&<.cmdPalette)lt.cmdPalette.open()">⌕ K</button>
|
|
||||||
|
|
||||||
<button type="button" class="lt-theme-btn" id="lt-theme-btn"
|
<button type="button" class="lt-theme-btn" id="lt-theme-btn"
|
||||||
aria-label="Toggle theme" title="Toggle light/dark mode">☀</button>
|
aria-label="Toggle theme" title="Toggle light/dark mode">☀</button>
|
||||||
@@ -346,8 +346,9 @@
|
|||||||
const btn = e.target.closest('[data-action]');
|
const btn = e.target.closest('[data-action]');
|
||||||
if (!btn) return;
|
if (!btn) return;
|
||||||
const action = btn.getAttribute('data-action');
|
const action = btn.getAttribute('data-action');
|
||||||
if (action === 'show-keyboard-help' && window.lt) lt.modal.open('lt-keys-help');
|
if (action === 'open-cmdpalette' && window.lt && lt.cmdPalette) lt.cmdPalette.open();
|
||||||
if (action === 'open-settings' && window.lt) lt.modal.open('lt-settings-modal');
|
if (action === 'show-keyboard-help' && window.lt) lt.modal.open('lt-keys-help');
|
||||||
|
if (action === 'open-settings' && window.lt) lt.modal.open('lt-settings-modal');
|
||||||
});
|
});
|
||||||
|
|
||||||
lt.keys.on('r', function() { lt.autoRefresh.now(); });
|
lt.keys.on('r', function() { lt.autoRefresh.now(); });
|
||||||
|
|||||||
Reference in New Issue
Block a user