-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Draft] Introduce KeyInterceptorService withs sync/async support to replace KeyInterceptor #9003
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #9003 +/- ##
==========================================
+ Coverage 89.82% 90.34% +0.51%
==========================================
Files 412 401 -11
Lines 11878 12206 +328
Branches 2364 2376 +12
==========================================
+ Hits 10670 11028 +358
+ Misses 681 643 -38
- Partials 527 535 +8 ☔ View full report in Codecov by Sentry. |
23eef77
to
ec5cc36
Compare
@danielchalmers var keyInterceptorOptions = KeyInterceptorOptions.Create(
targetClass: "mud-switch-base",
keys: new[]
{
// prevent scrolling page, instead increment
KeyOptions.Of(key: "ArrowUp", preventDown: "key+none"),
// prevent scrolling page, instead decrement
KeyOptions.Of(key: "ArrowDown", preventDown: "key+none"),
KeyOptions.Of(key: " ", preventDown: "key+none", preventUp: "key+none"),
});
await KeyInterceptorService.SubscribeAsync(_elementId, keyInterceptorOptions, keyDown: HandleKeyDown); We can't add constructor to |
@ScarletKuro Could we have two constructors? public KeyOptions()
{
}
public KeyOptions(string? key = null,
bool subscribeDown = false,
bool subscribeUp = false,
string preventDown = "none",
string preventUp = "none",
string stopDown = "none",
string stopUp = "none")
{
Key = key;
PreventDown = preventDown;
PreventUp = preventUp;
SubscribeDown = subscribeDown;
SubscribeUp = subscribeUp;
StopDown = stopDown;
StopUp = stopUp;
} public async Task SubscribeAsync(string elementId, string targetClass, bool EnableLogging, params KeyOptions[] keyOptions);
// Constructor could match this syntax.
await SubscribeAsync("my-id", "mud-switch-base",
enableLogging: false,
new("ArrowUp", preventDown: "key+none"),
new("ArrowDown", preventDown: "key+none"),
new(" ", preventDown: "key+none", preventUp: "key+none")); |
I don't think this is a good idea in await SubscribeAsync("my-id",
keyDown: KeyDownHandle,
keyUp: null, // We'd want to have them as the 2nd and 3rd parameters since we wouldn't want to have it between KeyInterceptorOptions entities
"mud-switch-base",
enableLogging: false,
new("ArrowUp", preventDown: "key+none"),
new("ArrowDown", preventDown: "key+none"),
new(" ", preventDown: "key+none", preventUp: "key+none")); You wouldn't be able to avoid having |
@ScarletKuro Maybe a fluent syntax with method calls if we wanted to get really fancy. |
MudRating - Add `role="radiogroup"` - Format razor MudRatingItem - Add `role="radio"` MudToggleGroup - Add `role="group"` - Format razor - still needs proper keyboard support (Waiting for MudBlazor#9003) MudToggleItem - Add `role="checkbox"`
Description
Fixes: #8992
Fises: #8583
NB! The old service is not removed, just slightly refactored. I don't think we should remove it, just obsolete.
The API is quite flexible, thats how you can use it:
View
MudDialogInstance.razor.cs
as example:MudBlazor/src/MudBlazor/Components/Dialog/MudDialogInstance.razor.cs
Lines 83 to 86 in ba830b1
How Has This Been Tested?
Not yet, only tested on dialog component that the concept is working
Type of Changes
Checklist
dev
).