Repository navigation
[KeyCode] Add Only, Ignore and PreventDefaultOnly to FluentKeyCodeProvider - #5477
Conversation
…deProvider The global provider only exposed PreventDefault, which prevents every browser shortcut, including the Escape key used to close dialogs. The filters supported by FluentKeyCode are now available on the provider. Fixes microsoft#4519
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes reuse existing filtering behavior, include regression coverage, and have no identified blocking issues.
No open issues 🎉
What changed in this PR
Exposes existing key filters through FluentKeyCodeProvider, enabling selective global keyboard handling for #4519.
Changes:
- Adds
Only,Ignore, andPreventDefaultOnlyparameters and forwards them toFluentKeyCode. - Adds regression coverage for all three filters.
| File | Description |
|---|---|
| tests/Core/Components/KeyCode/FluentKeyCodeTests.razor | Verifies filter values reach JavaScript registration. |
| src/Core/Components/KeyCode/FluentKeyCodeProvider.razor.cs | Declares the three provider parameters. |
| src/Core/Components/KeyCode/FluentKeyCodeProvider.razor | Forwards filters to the global component. |
Review effort: Balanced
|
Could you please provide a short video showing the issue before the code change, and then the expected behavior after the fix? This will make it easier to clearly see and validate the improvement. |
|
Before (dev): to block F5 with the global provider, the only option is 5477-before.mp4After (this PR): 5477-after.mp4 |
|
We've added a new requirement regarding PRs
|
Done |
Pull Request
📖 Description
FluentKeyCodeProvideronly exposedPreventDefault, which prevents the default action of every key, including theEsckey used to close dialogs. It now also exposes the filters already supported byFluentKeyCode, and passes them to its globalFluentKeyCode:PreventDefaultOnly: prevent the default action for some keys only.Only: listen to these keys only.Ignore: ignore these keys.The issue also suggests passing these options to
KeyCodeService.RegisterListener. That's not possible forPreventDefault: the default action must be prevented synchronously in the browser, before the listeners registered on the server are called. So the options are set on the provider, likePreventDefaulttoday.🎫 Issues
IgnoreandOnlyandPreventDefaultparameters to globalFluentKeyProvider#4519👩💻 Reviewer Notes
The provider passes the new parameters to its global
FluentKeyCode, which already supports them.📑 Test Plan
Unit tests
Added
FluentKeyCode_Provider_PassesKeyFilters.tests/Coresuite on this branch: 4904 tests, 0 failed (at64bf1d048).Other checks
✅ Checklist
General
AI contribution declaration
AI assistance is allowed; fully AI-generated or autonomous pull requests without meaningful human review are not accepted. See the AI contribution policy.
Component-specific
⏭ Next Steps
None.