Skip to content
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

Overriding default Browser shortcuts #21

Open
phcd30 opened this issue Apr 19, 2024 · 2 comments
Open

Overriding default Browser shortcuts #21

phcd30 opened this issue Apr 19, 2024 · 2 comments

Comments

@phcd30
Copy link

phcd30 commented Apr 19, 2024

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?

@jsakamoto
Copy link
Owner

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.

@phcd30
Copy link
Author

phcd30 commented Apr 26, 2024

Yes! That seems to work, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants