Toolbelt.Blazor.HotKeys2
Toolbelt.Blazor.HotKeys2 copied to clipboard
Overriding default Browser shortcuts
Is there a way to override the browser shortcuts, for example CTRL+S in Edge brings up the Save Dialog instead of the HotKeys configuration I've set up?
Hi @phcd30,
You must be able to override and prevent the default keyboard shortcuts like Ctrl+S without any specials.
However, in some cases, you need to use the HotKeys.CreateContext in the OnAfterRender lifecycle method instead of the OnInitialized lifecycle method. Otherwise, the Blazor HotKeys won't work. My README document said to use the OnInitialized, which might be why you asked such a question. Could you try using the OnAfterRender method instead of the OnInitialized method to initialize the hotkeys?
I have also attached the sample projects that override and prevent the browser's Ctrl+S keyboard shortcut. I hope these sample projects help you.
I also updated the README document to mention the use of the OnAfterRender method to initialize hotkeys.
Yes! That seems to work, thanks!