Open
Description
Issue description
In Microsoft Edge and Google Chrome I have noticed pressing F1 opens a help tab.
Repoduce in the affected browsers by following these steps:
- Visit: https://www.raylib.com/examples/shapes/loader.html?name=shapes_top_down_lights
- click anywhere in the running example to ensure it has focus
- Press 'F1' key
- See the problem.
I assume, given the pattern involves Chromium based browsers that this is true of other similarly based browsers. Firefox was unaffected.
Environment
Windows 11
Microsoft Edge Version 136.0.3240.76 (Official build) (64-bit)
Google Chrome Version 136.0.7103.114 (Official Build) (64-bit)
Possible Solution
I fixed this locally in my own build adding the following to my shell:
document.addEventListener('keydown', function(event)
{
if (event.key == 'F1' || event.keyCode == 112)
event.preventDefault();
});
this could easily be integrated into the web platform code like so:
EM_ASM({
document.addEventListener('keydown', function(event)
{
if (event.key == 'F1' || event.keyCode == 112)
event.preventDefault();
});
});
Probably somewhere in InitPlatform.