Repository navigation
[Keyboard Manager] Search, filter and bulk-delete for the remapping list - #49287
Conversation
|
Please add a screen recording of this running, thanks! |
|
Closing the PR for now as it's pending author response for too long. You can always reopen and continue on it. |
|
Thanks for the reviews on this one — and sorry for the delay on the recording. The demo you and Mike Griese (@zadjii-msft) asked for is ready (below), so this is unblocked. One snag: I can't reopen this from my side — GitHub refuses author-reopen after the auto-close (both the UI button and the API). Muyuan Li (@MuyuanMS) / Niels Laute (@niels9001), could you reopen it? If you'd rather I open a fresh PR that supersedes this one, just say the word and I'll do that instead. The branch is up to date on my fork (
This stays editor-only — the engine and the on-disk config schema are untouched, and filtering is never persisted. The recording (muted, on-screen captions) walks through: text search → the Win / Ctrl / Alt / Shift modifier toggles (OR within a group, AND across categories, including combining Ctrl + Alt) → the app filter → the "no results" empty state → Select mode → multi-select → Cancel → Delete selected → confirm → the rows are removed. Screen recording 👇 49287_final_v3.mp4 |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thanks for reopening it, Muyuan Li (@MuyuanMS) — much appreciated! 🙏 I'm keeping this one in Draft for now and will mark it Ready for review once #49136 lands, just to keep the review order clean. In the meantime the demo recording is posted above and CI is green here ( |
🧭 PR intakeVisual evidence: Required — The pull request changes product UI files, so reviewers need to see the visible result. Visual evidence was detected in the PR description. Recommendation
✅ Ready for reviewThis PR passed the automated intake checks and is ready for maintainer review. Automated PR intake; PowerToys maintainers make final decisions. |
|
takahashi (@MasaYan24) few conflicts popped up. If you can handle those conflicts we can start merging this :)! Amazing work! I do think we need some UI changes to make sure it's consistent with other Fluent UIs and to ensure we meet Accessibility criteria, but I can handle those once this is merged in. |
…pping list Add a filter bar above the mapping list so large remap sets stay navigable (this machine's config has 84 entries). Addresses microsoft#28434. - Text search over key names, target text/URL/program path and app (real-time). - Modifier toggles (Win/Ctrl/Alt/Shift) classify rows by raw VK code, so the filter is locale-independent; multiple toggles combine with OR. - App filter (All apps / Global only / each target app). - Filter categories combine with AND; a dedicated "no results" state offers a Clear action, distinct from the empty state. - Multi-select mode + "Delete selected (n)" with a confirmation dialog; only the currently visible (filtered) rows can be selected, so hidden rows stay safe. Implementation keeps the engine and config schema untouched: each section's bound ObservableCollection becomes a filtered view over a backing list, and ApplyFilter() rebuilds the views. Rows carry their raw trigger VK codes and a precomputed search string; existing per-row delete handlers are reused for bulk delete. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… refresh The per-row enable/disable ToggleSwitch binds IsOn via a OneTime x:Bind to IsActive and handles Toggled without guarding against non-user changes. ListView container recycling (heavy during search/filter, bulk-delete reloads and scrolling of a long list) re-applies the binding to the recycled-in item, which raises Toggled. The handler then calls Enable/DisableShortcut, whose non-idempotent ToggleShortcutKeyMappingActiveState flips the wrong entry's persisted active state, so unrelated shortcuts silently switch OFF. Guard the handler so it only acts when the control state actually diverges from the model (IsOn != IsActive), ignoring recycle/binding-induced events. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lbar "Add new remapping" sat on its own row at the top of the page, above the search / filter / bulk-select bar, reading as a page-level action. It is really a list-level action, so move it to the leading (left) edge of the list toolbar, aligned with the list below, and drop the now-empty top row. The button is kept outside the search/filter cluster (which hides when there are no mappings) so the first remapping can still be added from the empty state, and is given the accent style so the primary "create" action stands out among the neutral filter controls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJG9NHHEkEgFmp9W7djrnt
…clear exit Leaving multi-select mode crashed the settings panel: flipping IsSelectionMode off switches every list's SelectionMode to None, and the follow-up ClearAllSelections()/UpdateSelectedCount() then touch ListView.SelectedItems, which is only valid in Multiple mode and throws otherwise. The same path also fired after a bulk delete. - Clear the selection while the lists are still in Multiple mode, and guard both SelectedItems.Clear() and .Count behind a SelectionMode check so the selection housekeeping is safe in any mode. - The Select toggle now reads "Cancel" (with an "Exit selection mode" tooltip) while active, so there is always a visible way out of selection mode instead of a stuck-looking pressed "Select" button. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJG9NHHEkEgFmp9W7djrnt
Run the repo's XAML Styler over the search/filter toolbar markup so it passes the "Verify XAML formatting" CI step: reflow the "Add new remapping" comment to the styler's multi-line form and normalize attribute ordering on two toolbar StackPanels. Formatting only; no markup or behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EJG9NHHEkEgFmp9W7djrnt
1ea54bc to
09f8e70
Compare
|
Thanks Niels Laute (@niels9001)! 🙏 Conflicts are resolved — this is now rebased onto the latest The conflicts came from #49136 (alone/tap remap) landing in the same editor files. Both sides only added new members side by side, so the resolution keeps both: Verified locally after the rebase:
And sounds great re: the Fluent/accessibility polish — happy for you to take that once this is merged in. Thanks again for the review! |
|
takahashi (@MasaYan24) great work!! Love the new filters! I've passed this along to the design team, they had some feedback that the existing implementation might not scale and is not inline with the Fluent Design guidance. Based on their feedback I have made some changes to your PR and created a PR against it: MasaYan24#1 Can we get that one merged? Other than that I think it's good to go!!
|
Niels Laute (niels9001)
left a comment
There was a problem hiding this comment.
See comment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Merged! 🎉 Thanks a lot Niels Laute (@niels9001) — and thanks for looping in the design team. The redesign is in on Verified locally after the merge:
Could you re-review / dismiss the change request when you get a chance? Happy to pick up anything else you spot. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
takahashi (@MasaYan24) could you make a follow-up PR to add a UI test for this new feature? You could use the |
|
Sure thing, Gleb Khmyznikov (@khmyznikov) ??done: #50352 It turned out One caveat I called out in the PR: I could not run the suite locally (it resets the real Keyboard Manager configuration and takes over the desktop, and I have no isolated VM here), so it is compile-verified only. If someone can start |
…lete (#50352) ## Summary Follow-up to #49287, requested by @khmyznikov: UI tests for the remapping-list search, filters and bulk delete that shipped in that PR. `KeyboardManager.UITests` is already on the `Microsoft.PowerToys.UITest.Next` / winappcli harness, so this adds a test class to the existing project rather than scaffolding a new one. No product code changes. ## What the tests cover **`KeyboardManager.Editor.SearchAndFilter`** - <kbd>Ctrl</kbd>+<kbd>F</kbd> moves focus to the title-bar search box and the typed text narrows the list - **Clear filters** in the filter flyout restores the full list - The **Ctrl** and **Alt** modifier toggles each narrow the list to their own mapping - The application filter hides app-specific mappings under **Global only** - A search with no matches shows the dedicated **no-results** state, and its *Clear filters* button recovers from it - Searching and filtering never touch the persisted profile **`KeyboardManager.Editor.BulkDelete`** - Selection mode turns the toolbar button into the **Cancel** affordance - Two selected rows produce a `Delete selected (2)` label on an enabled bulk-delete button - Confirming the dialog removes **exactly** the two selected mappings and leaves the other two untouched - The editor leaves selection mode afterwards, and the deletion survives an editor restart ## Note on the seeded profile The seeded mappings deliberately use function keys (F13-F17) as their trigger keys. The Keyboard Manager engine is live while these tests run, so a remap on an ordinary letter would rewrite the characters the test types into the search box. ## Validation - `KeyboardManager.UITests` builds clean (x64 Debug); the new file produces no analyzer warnings. - I have **not** executed the suite locally. These tests reset the real `%LOCALAPPDATA%\Microsoft\PowerToys` Keyboard Manager configuration and take over the interactive desktop, and I do not have an isolated desktop/VM available on this machine. Could a maintainer kick off `/azp run` so the `Resolve affected UI test projects` job picks them up? Happy to iterate on anything that comes back red. ## Checklist - [x] **Closes:** n/a — follow-up to #49287 - [x] **Communication:** requested by @khmyznikov in #49287 (comment) - [x] **Tests:** this PR *is* the tests; no product code is changed - [x] **Localization:** no new user-facing strings - [x] **Dev docs:** no behaviour change to document Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

Summary of the Pull Request
Adds a search / filter / bulk-delete bar to the Keyboard Manager editor so that large remapping lists stay navigable. Once you accumulate many remaps the single flat list becomes hard to scan; this adds lightweight ways to narrow it down and to clean it up.
This is editor-only — the Keyboard Manager engine and the on-disk configuration schema are untouched. Filtering is a pure view concern and is never persisted.
Addresses #28434 ("Search in keyboard manager").
Demo
Muted screen recording with on-screen captions:
49287_final_v3.mp4
It walks through: text search → the Win / Ctrl / Alt / Shift modifier toggles (OR within a group, AND across categories, including combining Ctrl + Alt) → the app filter → the "no results" empty state → Select mode → multi-select → Cancel → Delete selected → confirm → the rows are removed.
Detailed Description of the PR
A filter bar is added above the mapping list:
All apps/Global only/ one entry per distinct target app.Selecttoggle turns on multi-selection across all sections;Delete selected (n)removes them after a confirmation dialog. Only the currently visible (filtered) rows can be selected, so rows hidden by a filter can never be deleted by accident.Implementation notes
ListViewover anObservableCollection. Those bound collections become filtered views over new backing lists;ApplyFilter()rebuilds them. Section visibility already keys off.Count, so filtered-empty sections collapse for free.PR Checklist
.reswresources.Validation Steps Performed
KeyboardManagerEditorUI(Debug/x64) — clean, analyzers/StyleCop green.