From 25fc5a26ffd5d6ac88d7448770c670c217db7a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Thu, 24 Jul 2025 05:36:46 +0200 Subject: [PATCH] CmdPal: Make IconBox unfocusable and unreachable by keyboard navigation by default (#40636) ## Summary of the Pull Request IconBox controls no longer receive keyboard focus by default. as their focus state is not visually represented and they serve primarily as decorative roles in the application. For cases where keyboard navigation on an IconBox is desired, focusability can be enabled explicitly on the specific instance. ## PR Checklist - [x] **Closes:** #40617 - [ ] **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 - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- .../cmdpal/Microsoft.CmdPal.UI/Controls/IconBox.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconBox.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconBox.cs index c0a4e5a16c..ba4c9d8c17 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconBox.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/IconBox.cs @@ -7,6 +7,8 @@ using Microsoft.CmdPal.UI.Deferred; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; + using Windows.Foundation; namespace Microsoft.CmdPal.UI.Controls; @@ -49,6 +51,12 @@ public partial class IconBox : ContentControl /// public event TypedEventHandler? SourceRequested; + public IconBox() + { + TabFocusNavigation = KeyboardNavigationMode.Once; + IsTabStop = false; + } + private static void OnSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is IconBox @this)