Skip to content

Bug: Slash Command Dropdown Selection Not Working - #189

Merged
malibio merged 2 commits into
mainfrom
feature/issue-187-fix-slash-command-dropdown
Oct 8, 2025
Merged

malibio merged 2 commits into
mainfrom
feature/issue-187-fix-slash-command-dropdown

Conversation

@malibio

@malibio malibio commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

Closes #187

malibio and others added 2 commits October 8, 2025 12:21
## 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
malibio merged commit e963665 into main Oct 8, 2025
@malibio
malibio deleted the feature/issue-187-fix-slash-command-dropdown branch October 8, 2025 11:33
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Slash Command Dropdown Selection Not Working

1 participant