Skip to content

Peek: Show error message when activated in unsupported virtual folders#44703

Merged
lei9444 merged 2 commits intomainfrom
leilzh/fixpeek1
Jan 13, 2026
Merged

Peek: Show error message when activated in unsupported virtual folders#44703
lei9444 merged 2 commits intomainfrom
leilzh/fixpeek1

Conversation

@lei9444
Copy link
Copy Markdown
Contributor

@lei9444 lei9444 commented Jan 13, 2026

Summary of the Pull Request

When Peek is activated in virtual folders like Home or Recent, it now displays a clear error message instead of showing a stuck loading state or "Search in Microsoft Store" link.

Problem

When users activate Peek (press the hotkey) in Windows virtual folders such as Home or Recent, the Shell API (SVGIO_SELECTION) returns 0 items because these folders don't support the standard file selection retrieval mechanism. Previously, this caused:

  • The Peek window to appear stuck in a loading state
  • The "Search in Microsoft Store" fallback UI to display incorrectly
  • Subsequent Peek activations to fail until the window was manually closed
image

Solution

  • Added a check in Initialize() to detect when no files are found after querying the Shell
  • Display an error InfoBar with a user-friendly message: "No files selected or this folder is not supported for preview."
  • Hide the FilePreview control when the error is shown to prevent displaying irrelevant fallback UI
  • Close the window automatically when the user dismisses the InfoBar (clicks X)
image

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

}

/// <summary>
/// Returns Visibility.Visible if error is not showing, otherwise Collapsed.

Check failure

Code scanning / check-spelling

Forbidden Pattern

[, otherwise](#security-tab) matches a line_forbidden.patterns entry: ", [Oo\]therwise\\\b". \(forbidden-pattern\)
@lei9444 lei9444 merged commit 7444835 into main Jan 13, 2026
15 checks passed
@yeelam-gordon yeelam-gordon added this to the PowerToys 0.97 milestone Jan 16, 2026
@yeelam-gordon yeelam-gordon added the Product-Peek Refers to Peek Powertoys label Jan 16, 2026
yeelam-gordon added a commit that referenced this pull request Jan 23, 2026
Don't show error window when CurrentItem is null - just return silently.
This restores the original behavior where CaretVisible() detection in
GetSelectedItems() would suppress Peek by returning null, and no window
would be shown.

PR #44703 added an error window for virtual folders (Home/Recent), but
this also triggered when user was typing (rename, search, address bar),
stealing focus and cancelling the operation.

Fixes #44845
vanzue pushed a commit that referenced this pull request Jan 26, 2026
Don't show error window when CurrentItem is null - just return silently.
This restores the original behavior where CaretVisible() detection in
GetSelectedItems() would suppress Peek by returning null, and no window
would be shown.

PR #44703 added an error window for virtual folders (Home/Recent), but
this also triggered when user was typing (rename, search, address bar),
stealing focus and cancelling the operation.

Fixes #44845

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
vanzue pushed a commit that referenced this pull request Jan 26, 2026
Don't show error window when CurrentItem is null - just return silently.
This restores the original behavior where CaretVisible() detection in
GetSelectedItems() would suppress Peek by returning null, and no window
would be shown.

PR #44703 added an error window for virtual folders (Home/Recent), but
this also triggered when user was typing (rename, search, address bar),
stealing focus and cancelling the operation.

Fixes #44845

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
yeelam-gordon added a commit that referenced this pull request Jan 31, 2026
Don't show error window when CurrentItem is null - just return silently.
This restores the original behavior where CaretVisible() detection in
GetSelectedItems() would suppress Peek by returning null, and no window
would be shown.

PR #44703 added an error window for virtual folders (Home/Recent), but
this also triggered when user was typing (rename, search, address bar),
stealing focus and cancelling the operation.

Fixes #44845

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In for .97 Product-Peek Refers to Peek Powertoys

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerToys Peek spacebar & click on a .pdf file opens a window searching Microsoft store

5 participants