Skip to content

Fix preview closing when typing a space in search - #2035

Open
MORTEM3845 wants to merge 1 commit into
QL-Win:masterfrom
MORTEM3845:fix/2027-search-keyboard-focus
Open

MORTEM3845 wants to merge 1 commit into
QL-Win:masterfrom
MORTEM3845:fix/2027-search-keyboard-focus

Conversation

@MORTEM3845

@MORTEM3845 MORTEM3845 commented Oct 23, 2026 •

Copy link
Copy Markdown

PR Checklist

  • Functionality has been tested, no obvious bugs
  • Code style follows project conventions
  • Documentation/comments updated (if applicable)

Brief Description of Changes

Skip global preview shortcuts while an editable text field has focus, so Space no longer closes the preview and Enter no longer opens an external editor while searching.

Manual testing confirmed the preview stays open when entering a leading space in search. Build passed.

Related Issue

Fixes #2027

Summary by CodeRabbit

  • Bug Fixes
    • Keyboard shortcuts no longer trigger preview actions while focus is in an editable text box, allowing normal text entry without unintended interruptions. Shortcuts remain available when focus is elsewhere.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 621f1ce1-238e-4aaf-a8a7-36a8d4388624
📥 Commits

Reviewing files that changed from the base of the PR and between 2ec219a and 3ecd535.

📒 Files selected for processing: 1
  • QuickLook/KeystrokeDispatcher.cs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Keystroke dispatch now returns early when the app is foreground and keyboard focus is on an editable WPF text box. Before returning, it clears preview-request, Space-hold, and invalid-key-delay state.

Changes: Editable text input

Layer / File(s) Summary
Editable text box focus guard
QuickLook/KeystrokeDispatcher.cs
The dispatcher checks WPF keyboard focus before processing keystrokes. When focus is on an editable text box and the app is foreground, it clears related state and returns without dispatching.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 3ecd5

The change addresses the reported search-box shortcut behavior without an established regression.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: preventing the preview from closing when the user types a space in the search field.
Linked Issues check Passed Issue #2027 requires Space and Enter in the search box to avoid global preview actions. QuickLook/KeystrokeDispatcher.cs returns before dispatch when QuickLook owns the foreground window and `Keyboa…
Out of Scope Changes check Passed The supplied whole-PR summary identifies changes only in QuickLook/KeystrokeDispatcher.cs. The changes add the focus check and reset shortcut state that directly support issue #2027. No unrelated ch…
Full details: Linked Issues check

Explanation

Issue #2027 requires Space and Enter in the search box to avoid global preview actions. QuickLook/KeystrokeDispatcher.cs returns before dispatch when QuickLook owns the foreground window and Keyboard.FocusedElement is an editable WPF TextBoxBase. This prevents Space from toggling or closing the preview and prevents Enter from sending PipeMessages.RunAndClose. The same path clears pending shortcut state. The reviewed file provides the implementation for both issue behaviors.

Full details: Out of Scope Changes check

Explanation

The supplied whole-PR summary identifies changes only in QuickLook/KeystrokeDispatcher.cs. The changes add the focus check and reset shortcut state that directly support issue #2027. No unrelated change is evidenced.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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] If the first character entered into the search box is a space, the preview window will close.

1 participant