Repository navigation
Bug: Slash Command Dropdown Selection Not Working - #189
Merged
Merged
Conversation
## Problem
The slash command dropdown modal appeared when typing '/', but clicking
on an item or pressing Enter had no effect. Commands could only be used
by typing them directly.
## Root Cause
Prop/event handler mismatch between SlashCommandDropdown component and
its usage in base-node.svelte:
- SlashCommandDropdown expected callback props: `onselect` and `onclose`
- base-node.svelte was passing event listeners: `on:select` and `on:close`
This meant the callbacks were never connected, so selections were ignored.
## Solution
Updated base-node.svelte to pass callback props instead of event listeners:
- Changed `on:select={handleSlashCommandSelect}` to `onselect={handleSlashCommandSelect}`
- Changed `on:close={handleSlashCommandClose}` to `onclose={handleSlashCommandClose}`
- Updated handleSlashCommandSelect signature to accept SlashCommand directly
This matches the pattern used by NodeAutocomplete and is the correct
approach for Svelte 5 components using callback props.
## Testing
- All 39 slash command dropdown tests pass
- Manual testing confirms slash commands work via dropdown selection
- Keyboard navigation (Enter, Escape, Arrow keys) works correctly
- Click selection works correctly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
These tests would have caught bug #187, where the SlashCommandDropdown component's onselect/onclose callbacks weren't properly wired to BaseNode. ## What These Tests Verify The key insight is that **dropdown closure after selection proves the callback chain works**. If callbacks aren't wired, the dropdown stays open. Test coverage: - Dropdown displays when "/" is typed - Dropdown closes after Enter key selection (proves callback works) - Dropdown closes after mouse click selection (proves callback works) - Dropdown closes on Escape without selection - Command filtering works - Keyboard navigation works ## Why Unit Tests Weren't Enough Unit tests for SlashCommandDropdown verified the component worked in isolation by passing mock callbacks and checking they were called. However, they missed the integration issue where BaseNode was using **event listeners** (on:select) instead of **callback props** (onselect). This is a Svelte 5 pattern difference - the dropdown uses callback props, not event dispatchers. ## Testing Strategy Since BaseNode is Svelte 5 and doesn't support component.$on(), we test by verifying observable side effects rather than listening to events: - Dropdown appears (slash command detection works) - Dropdown disappears after selection (callback chain works) - Content changes appropriately Related: Issue #187 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 4, 2026
* Fix slash command dropdown selection not working (closes #187) ## Problem The slash command dropdown modal appeared when typing '/', but clicking on an item or pressing Enter had no effect. Commands could only be used by typing them directly. ## Root Cause Prop/event handler mismatch between SlashCommandDropdown component and its usage in base-node.svelte: - SlashCommandDropdown expected callback props: `onselect` and `onclose` - base-node.svelte was passing event listeners: `on:select` and `on:close` This meant the callbacks were never connected, so selections were ignored. ## Solution Updated base-node.svelte to pass callback props instead of event listeners: - Changed `on:select={handleSlashCommandSelect}` to `onselect={handleSlashCommandSelect}` - Changed `on:close={handleSlashCommandClose}` to `onclose={handleSlashCommandClose}` - Updated handleSlashCommandSelect signature to accept SlashCommand directly This matches the pattern used by NodeAutocomplete and is the correct approach for Svelte 5 components using callback props. ## Testing - All 39 slash command dropdown tests pass - Manual testing confirms slash commands work via dropdown selection - Keyboard navigation (Enter, Escape, Arrow keys) works correctly - Click selection works correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Add integration tests for slash command callback wiring These tests would have caught bug #187, where the SlashCommandDropdown component's onselect/onclose callbacks weren't properly wired to BaseNode. ## What These Tests Verify The key insight is that **dropdown closure after selection proves the callback chain works**. If callbacks aren't wired, the dropdown stays open. Test coverage: - Dropdown displays when "/" is typed - Dropdown closes after Enter key selection (proves callback works) - Dropdown closes after mouse click selection (proves callback works) - Dropdown closes on Escape without selection - Command filtering works - Keyboard navigation works ## Why Unit Tests Weren't Enough Unit tests for SlashCommandDropdown verified the component worked in isolation by passing mock callbacks and checking they were called. However, they missed the integration issue where BaseNode was using **event listeners** (on:select) instead of **callback props** (onselect). This is a Svelte 5 pattern difference - the dropdown uses callback props, not event dispatchers. ## Testing Strategy Since BaseNode is Svelte 5 and doesn't support component.$on(), we test by verifying observable side effects rather than listening to events: - Dropdown appears (slash command detection works) - Dropdown disappears after selection (callback chain works) - Content changes appropriately Related: Issue #187 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 5, 2026
* Fix slash command dropdown selection not working (closes #187) ## Problem The slash command dropdown modal appeared when typing '/', but clicking on an item or pressing Enter had no effect. Commands could only be used by typing them directly. ## Root Cause Prop/event handler mismatch between SlashCommandDropdown component and its usage in base-node.svelte: - SlashCommandDropdown expected callback props: `onselect` and `onclose` - base-node.svelte was passing event listeners: `on:select` and `on:close` This meant the callbacks were never connected, so selections were ignored. ## Solution Updated base-node.svelte to pass callback props instead of event listeners: - Changed `on:select={handleSlashCommandSelect}` to `onselect={handleSlashCommandSelect}` - Changed `on:close={handleSlashCommandClose}` to `onclose={handleSlashCommandClose}` - Updated handleSlashCommandSelect signature to accept SlashCommand directly This matches the pattern used by NodeAutocomplete and is the correct approach for Svelte 5 components using callback props. ## Testing - All 39 slash command dropdown tests pass - Manual testing confirms slash commands work via dropdown selection - Keyboard navigation (Enter, Escape, Arrow keys) works correctly - Click selection works correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Add integration tests for slash command callback wiring These tests would have caught bug #187, where the SlashCommandDropdown component's onselect/onclose callbacks weren't properly wired to BaseNode. ## What These Tests Verify The key insight is that **dropdown closure after selection proves the callback chain works**. If callbacks aren't wired, the dropdown stays open. Test coverage: - Dropdown displays when "/" is typed - Dropdown closes after Enter key selection (proves callback works) - Dropdown closes after mouse click selection (proves callback works) - Dropdown closes on Escape without selection - Command filtering works - Keyboard navigation works ## Why Unit Tests Weren't Enough Unit tests for SlashCommandDropdown verified the component worked in isolation by passing mock callbacks and checking they were called. However, they missed the integration issue where BaseNode was using **event listeners** (on:select) instead of **callback props** (onselect). This is a Svelte 5 pattern difference - the dropdown uses callback props, not event dispatchers. ## Testing Strategy Since BaseNode is Svelte 5 and doesn't support component.$on(), we test by verifying observable side effects rather than listening to events: - Dropdown appears (slash command detection works) - Dropdown disappears after selection (callback chain works) - Content changes appropriately Related: Issue #187 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 26, 2026
* Fix slash command dropdown selection not working (closes #187) ## Problem The slash command dropdown modal appeared when typing '/', but clicking on an item or pressing Enter had no effect. Commands could only be used by typing them directly. ## Root Cause Prop/event handler mismatch between SlashCommandDropdown component and its usage in base-node.svelte: - SlashCommandDropdown expected callback props: `onselect` and `onclose` - base-node.svelte was passing event listeners: `on:select` and `on:close` This meant the callbacks were never connected, so selections were ignored. ## Solution Updated base-node.svelte to pass callback props instead of event listeners: - Changed `on:select={handleSlashCommandSelect}` to `onselect={handleSlashCommandSelect}` - Changed `on:close={handleSlashCommandClose}` to `onclose={handleSlashCommandClose}` - Updated handleSlashCommandSelect signature to accept SlashCommand directly This matches the pattern used by NodeAutocomplete and is the correct approach for Svelte 5 components using callback props. ## Testing - All 39 slash command dropdown tests pass - Manual testing confirms slash commands work via dropdown selection - Keyboard navigation (Enter, Escape, Arrow keys) works correctly - Click selection works correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Add integration tests for slash command callback wiring These tests would have caught bug #187, where the SlashCommandDropdown component's onselect/onclose callbacks weren't properly wired to BaseNode. ## What These Tests Verify The key insight is that **dropdown closure after selection proves the callback chain works**. If callbacks aren't wired, the dropdown stays open. Test coverage: - Dropdown displays when "/" is typed - Dropdown closes after Enter key selection (proves callback works) - Dropdown closes after mouse click selection (proves callback works) - Dropdown closes on Escape without selection - Command filtering works - Keyboard navigation works ## Why Unit Tests Weren't Enough Unit tests for SlashCommandDropdown verified the component worked in isolation by passing mock callbacks and checking they were called. However, they missed the integration issue where BaseNode was using **event listeners** (on:select) instead of **callback props** (onselect). This is a Svelte 5 pattern difference - the dropdown uses callback props, not event dispatchers. ## Testing Strategy Since BaseNode is Svelte 5 and doesn't support component.$on(), we test by verifying observable side effects rather than listening to events: - Dropdown appears (slash command detection works) - Dropdown disappears after selection (callback chain works) - Content changes appropriately Related: Issue #187 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #187