Skip to content

Conversation

@malore350
Copy link
Contributor

Pull Request

  • Fixed File Selection: Resolved a race condition in the Command Bar (Ctrl+P) where a mousedown listener for "click outside" was triggering before item selection, preventing files from opening.
  • Standardized Backdrop Interaction: Enabled closing the Command Bar, Theme Selector, Icon Theme Selector, and Vim Command Bar by clicking the background backdrop.
  • Consistency Improvements: Standardized the use of the onClose prop across all components utilizing the shared Command UI layout.

Description

The root cause of the file selection failure was a manual mousedown listener in useCommandBar.ts that lacked a proper data-command-bar reference. This caused the component to unmount before the onClick event could fire on file items. By removing this manual listener and leveraging the onClose callback built into the Command component's backdrop, we achieve both reliable file opening and intuitive "click outside" behavior.

Additionally, several other command-style overlays were using the Command layout but not passing the onClose callback, preventing users from closing them via background clicks. These have now been aligned for a more consistent UX.

Testing

  1. Open Command Bar (Ctrl+P) and click a file: Verified file opens correctly.
  2. Open Command Bar and click the backdrop: Verified overlay closes.
  3. Open Theme Selector and click the backdrop: Verified overlay closes.
  4. Open Vim Command Bar (:) and click the backdrop: Verified overlay closes.

Related Issues

Fixes #517

- Fix issue where clicking files in the Command Bar (Ctrl+P) would close the overlay without opening the file by removing a buggy `mousedown` listener.
- Standardize the `onClose` behavior for Command Bar, Theme Selector, Icon Theme Selector, and Vim Command Bar.
- Enable closing these overlays by clicking the background backdrop, ensuring UI consistency across all command-style components.
Copilot AI review requested due to automatic review settings January 19, 2026 23:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical race condition bug in the Command Bar that prevented file selection via mouse clicks, and standardizes backdrop closing behavior across all command-style overlays.

Changes:

  • Fixed the Command Bar file selection bug by removing a problematic mousedown listener that was closing the component before file item clicks could register
  • Enabled backdrop click-to-close functionality for Command Bar, Theme Selector, Icon Theme Selector, and Vim Command Bar by passing the onClose prop to the Command component

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/features/command-bar/hooks/use-command-bar.ts Removed manual mousedown listener that was causing the race condition
src/features/command-bar/components/command-bar.tsx Added onClose prop to enable backdrop closing
src/features/command-palette/components/theme-selector.tsx Added onClose prop to enable backdrop closing
src/features/command-palette/components/icon-theme-selector.tsx Added onClose prop to enable backdrop closing
src/features/vim/components/vim-command-bar.tsx Added onClose prop to enable backdrop closing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

File search

1 participant