fix: keep slash command suggestions visible when typing exact command names (#157)

Previously, typing "/org" would hide the suggestion immediately upon
completion. Now suggestions only disappear when user presses space
or Enter, making it clearer that the command is available to execute.

Fixes UX issue where users lose visual confirmation of valid commands.
This commit is contained in:
Chad Metcalf 2025-08-05 16:04:26 -07:00 • committed by GitHub
parent ee34a701ef
commit 8536dc3c8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,13 +105,13 @@ const UserInput: React.FC<UserInputProps> = ({
const allCommands = getSlashCommands();
const exactMatch = allCommands.find((cmd) => cmd.name === afterSlash);
// Hide selector if we have an exact match and there's more content after the cursor
// Hide selector if we have an exact match and there's a space after cursor
if (exactMatch) {
const restOfText = text.slice(cursor);
// If there's a space immediately after cursor, or we're at end of line/text, hide selector
// Only hide if there's a space or newline immediately after cursor
// Don't hide just because we're at the end - user might want to see the suggestion
if (
restOfText.startsWith(" ") ||
restOfText === "" ||
restOfText.startsWith("\n")
) {
setShowSlashCommands(false);