Skip to content

[Enhancement] Restore Keyboard Focus to Chat Input After Closing Keyboard Shortcuts Modal #821

Description

@kareena0229

Is your feature request related to a problem? Please describe.

Currently, when the Keyboard Shortcuts help modal is closed (either by clicking the close button, clicking outside the modal, or pressing Esc), the keyboard focus is not returned to the chat input. Keyboard users need to manually click the input field before they can continue typing.

Describe the solution you'd like

After the shortcuts modal is closed, automatically restore focus to the chat input using the existing textareaRef.

Example:

textareaRef.current?.focus();

This should work regardless of how the modal is dismissed:

  • Close button
  • Clicking outside the modal
  • Pressing Esc

Benefits

  • Improves keyboard accessibility.
  • Creates a smoother chat experience.
  • Lets users continue typing immediately after closing the modal.
  • Follows common accessibility and focus management practices.

Describe alternatives you've considered

Users can manually click the chat input after closing the modal, but this adds unnecessary interaction and interrupts keyboard-based workflows.

Affected File

frontend/src/components/chat/ChatPanel.tsx

Additional Context

This change is small, backward-compatible, and only improves focus management without affecting existing chat functionality.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvementgssocGirlScript Summer of Code 2026 issue/PR

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions