Skip to content

fix: Retain focus in chat input after typing question mark #67

@sierragolflima

Description

@sierragolflima

Description

In the AI Chat window, typing a ? (question mark) causes the text input to lose focus. This breaks the workflow because:

  • The cursor disappears from the input
  • Pressing Enter no longer sends the message
  • User must click back into the input to continue

Current Behavior

After typing ?, focus is lost from the MonacoEditorView component.

Expected Behavior

Focus should remain in the input after typing any character, including punctuation marks like ?.

Files to Investigate

  • src/MeshWeaver.Blazor.Chat/ChatInput.razor (lines 10-18)
  • src/MeshWeaver.Blazor/MonacoEditorView.razor
  • Check CompletionProvider and AsyncCompletionCallback parameters

Possible Causes

  1. Monaco editor autocomplete/suggestion popup stealing focus on ?
  2. Event handler treating ? as a help/command trigger
  3. Blazor re-render causing focus loss
  4. Autocomplete completion callback interfering

Implementation Hint

Check if ? triggers autocomplete in MonacoEditorView. If so, either:

  • Prevent ? from triggering autocomplete
  • Ensure focus returns after autocomplete dismisses
  • Check OnSubmit handler for focus side effects

Acceptance Criteria

  • Focus remains in chat input after typing ?
  • Focus remains after typing other punctuation (., !, etc.)
  • Enter key sends message correctly after typing punctuation
  • Autocomplete still works for @ mentions if applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguifront-end

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions