diff options
| author | Tyler <tyler@tylerhoang.xyz> | 2026-05-17 01:15:46 -0700 |
|---|---|---|
| committer | Tyler <tyler@tylerhoang.xyz> | 2026-05-17 01:15:46 -0700 |
| commit | f013bf1243c191b8d6d23db1f144cb2f7270d063 (patch) | |
| tree | f5741c7fbb76e525104abe7f14e96b7c44cfa2ae | |
| parent | c3268bc66c141dcaa647c674bad288586893e851 (diff) | |
Switch keyboard shortcut from Ctrl+K to / for ticker search focus
Ctrl+K conflicts with the browser address bar on Linux. / is the
conventional global search shortcut (GitHub, Linear) and is not
intercepted by browsers. Guard prevents firing while an input is focused.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | app.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -775,11 +775,13 @@ st.divider() components.html( "<script>" "document.addEventListener('keydown', function(e) {" - " if ((e.metaKey || e.ctrlKey) && e.key === 'k') {" - " e.preventDefault();" + " if (e.key === '/' && !e.metaKey && !e.ctrlKey && !e.altKey" + " && document.activeElement.tagName !== 'INPUT'" + " && document.activeElement.tagName !== 'TEXTAREA') {" " var inputs = window.parent.document.querySelectorAll('input');" " for (var i = 0; i < inputs.length; i++) {" " if (inputs[i].placeholder && inputs[i].placeholder.indexOf('AAPL') > -1) {" + " e.preventDefault();" " inputs[i].focus(); inputs[i].select(); break;" " }" " }" |
