From 20073ccf57410c80b099b0bfedfce96d492d07fb Mon Sep 17 00:00:00 2001 From: Henry Park Date: Mon, 2 Mar 2026 13:06:55 -0800 Subject: [PATCH] fix(web): auto-scroll and Enter key completion for slash command autocomplete (#475) - Add scrollIntoView to keep arrow-key-selected item visible in dropdown - Make Enter complete the first matching command when autocomplete is visible, instead of requiring explicit arrow-key navigation first Co-authored-by: Claude Opus 4.6 (1M context) --- src/channels/web/static/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/channels/web/static/app.js b/src/channels/web/static/app.js index 578cbd9c..aa18dc53 100644 --- a/src/channels/web/static/app.js +++ b/src/channels/web/static/app.js @@ -359,6 +359,9 @@ function selectSlashItem(cmd) { function updateSlashHighlight() { const items = document.querySelectorAll('#slash-autocomplete .slash-ac-item'); items.forEach((el, i) => el.classList.toggle('selected', i === _slashSelected)); + if (_slashSelected >= 0 && items[_slashSelected]) { + items[_slashSelected].scrollIntoView({ block: 'nearest' }); + } } function filterSlashCommands(value) { @@ -1196,7 +1199,7 @@ chatInput.addEventListener('keydown', (e) => { updateSlashHighlight(); return; } - if (e.key === 'Tab' || (e.key === 'Enter' && _slashSelected >= 0)) { + if (e.key === 'Tab' || e.key === 'Enter') { e.preventDefault(); const pick = _slashSelected >= 0 ? _slashMatches[_slashSelected] : _slashMatches[0]; if (pick) selectSlashItem(pick.cmd);