🙋 Feature Request
When using the global FluentKeyProvider approach then you are very limited in it's use-case.
https://fluentui-blazor-v5.azurewebsites.net/KeyCode
You can set PreventDefault="true" but this will prevent all native shortcuts and even FluentUI Blazor features like closing dialogs with ESC key.
You might want to setup some global keycodes which should be prevented by default and the logic for them needs to implemented on a per page basis.
This is currently not possible. You can only achieve this behaviour by either
- Use the
FluentKeyCode component directly on the page which is limited because the element needs to be within the FluentKeyCode area and it needs to have an active focus
- Provide
FluentKeyCode on MainLayout.razor and register events on a per page basis like this:
Which introduces a lot of boilterplate and hard to manage code for the developer.
💁 Possible Solution
When using KeyCodeService.RegisterListener(this); we could pass in options like PreventDefault, Ignore and Only parameters like in FluentKeyCode
🔦 Context
This issue can be seen in live action the v4 branch as well https://www.fluentui-blazor.net/ press / to trigger search but then you see that the / will be within the input as well. When using PreventDefault on the FluentKeyProvider then literally all component functionality which is based on KeyCode will stop working because it will be prevented.
💻 Examples
I have crafted together this v5 sample app.
https://github.com/MarvinKlein1508/KeyCodeV5
🙋 Feature Request
When using the global
FluentKeyProviderapproach then you are very limited in it's use-case.https://fluentui-blazor-v5.azurewebsites.net/KeyCode
You can set
PreventDefault="true"but this will prevent all native shortcuts and even FluentUI Blazor features like closing dialogs withESCkey.You might want to setup some global keycodes which should be prevented by default and the logic for them needs to implemented on a per page basis.
This is currently not possible. You can only achieve this behaviour by either
FluentKeyCodecomponent directly on the page which is limited because the element needs to be within theFluentKeyCodearea and it needs to have an active focusFluentKeyCodeonMainLayout.razorand register events on a per page basis like this:Which introduces a lot of boilterplate and hard to manage code for the developer.
💁 Possible Solution
When using
KeyCodeService.RegisterListener(this);we could pass in options likePreventDefault,IgnoreandOnlyparameters like inFluentKeyCode🔦 Context
This issue can be seen in live action the v4 branch as well https://www.fluentui-blazor.net/ press
/to trigger search but then you see that the/will be within the input as well. When usingPreventDefaulton theFluentKeyProviderthen literally all component functionality which is based onKeyCodewill stop working because it will be prevented.💻 Examples
I have crafted together this v5 sample app.
https://github.com/MarvinKlein1508/KeyCodeV5