[PR #4402] [CLOSED] Introduce keyboard (Up/Down/Enter/Escape) selection for slash commands #4612

Closed
opened 2026-02-22 18:36:11 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4402
Author: @angelplusultra
Created: 9/18/2025
Status: Closed

Base: masterHead: 2019-slash-command-keyboard-selection


📝 Commits (6)

  • 9cad6a6 Add functionality for slash command selection via keydown event
  • 26ac150 Move keydown event handler from inline to function declaration
  • f0840ed Add Escape key functionality to hide slash command input
  • 7549f51 Update Escape key functionality to conditionally hide slash command input only if its enabled
  • 3e85053 Abstract majority of slash command logic into useSlashCommand hook | Fix bug where slash command navigation wasn't working when triggered with slash command button | Fix bug with overflowed slash commands not being scrolled into view on navigation | Refactored slash command selection logic from custom event emission to direct handling in handleKeyDown fn.
  • 9389a2f Remove unused state variables from useSlashCommands hook to clean up code and improve readability.

📊 Changes

5 files changed (+180 additions, -35 deletions)

View changed files

📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SlashCommands/SlashPresets/index.jsx (+25 -8)
📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SlashCommands/index.jsx (+17 -7)
📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SlashCommands/reset.jsx (+16 -2)
📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx (+22 -18)
frontend/src/hooks/useSlashCommands.js (+100 -0)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #2019

What is in this change?

This PR introduces keyboard navigation for the slash command selection popup.

Users can now:

  • Navigate options using the Up and Down arrow keys.
  • Select a command by pressing Enter.
  • Close the popup by pressing Escape.

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4402 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 9/18/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `2019-slash-command-keyboard-selection` --- ### 📝 Commits (6) - [`9cad6a6`](https://github.com/Mintplex-Labs/anything-llm/commit/9cad6a60c0f9f986fd35cc4c3d56d5ba472dc99f) Add functionality for slash command selection via keydown event - [`26ac150`](https://github.com/Mintplex-Labs/anything-llm/commit/26ac150161b42d87366f9eab6bb15b2048209c2c) Move keydown event handler from inline to function declaration - [`f0840ed`](https://github.com/Mintplex-Labs/anything-llm/commit/f0840edf9bcf78b66c6391219caaac706d664ea1) Add Escape key functionality to hide slash command input - [`7549f51`](https://github.com/Mintplex-Labs/anything-llm/commit/7549f51dbca5c87ab01e7a83bdb9a912ba6fdea0) Update Escape key functionality to conditionally hide slash command input only if its enabled - [`3e85053`](https://github.com/Mintplex-Labs/anything-llm/commit/3e85053755a50e7aecb3e54a2aef49c15deb4a93) Abstract majority of slash command logic into useSlashCommand hook | Fix bug where slash command navigation wasn't working when triggered with slash command button | Fix bug with overflowed slash commands not being scrolled into view on navigation | Refactored slash command selection logic from custom event emission to direct handling in handleKeyDown fn. - [`9389a2f`](https://github.com/Mintplex-Labs/anything-llm/commit/9389a2ff2b50c6beb45134d33ddb05b2502ae211) Remove unused state variables from useSlashCommands hook to clean up code and improve readability. ### 📊 Changes **5 files changed** (+180 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SlashCommands/SlashPresets/index.jsx` (+25 -8) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SlashCommands/index.jsx` (+17 -7) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SlashCommands/reset.jsx` (+16 -2) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx` (+22 -18) ➕ `frontend/src/hooks/useSlashCommands.js` (+100 -0) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [x] ✨ feat - [ ] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #2019 ### What is in this change? <!-- Describe the changes in this PR that are impactful to the repo. --> This PR introduces keyboard navigation for the slash command selection popup. Users can now: - Navigate options using the `Up` and `Down` arrow keys. - Select a command by pressing `Enter`. - Close the popup by pressing `Escape`. ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [ ] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:11 -05:00
yindo closed this issue 2026-02-22 18:36:11 -05:00
yindo changed title from [PR #4402] Introduce keyboard (Up/Down/Enter/Escape) selection for slash commands to [PR #4402] [CLOSED] Introduce keyboard (Up/Down/Enter/Escape) selection for slash commands 2026-06-05 15:19:27 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4612