Function keys do not work properly with certain keyboards on macOS
Minecraft Version: 1.20.1, 1.20.4, 1.21.1
NeoForge Version: 47.1.106, 20.4.237, 21.1.77
Logs: 1.21.1: https://gist.github.com/unilock/a699a9ebba05e3da37dbb5759e381f16
Steps to Reproduce:
- Install Minecraft 1.21.1 + NeoForge on macOS
- Attempt to bind a key to a function key (F1, F2, F3, ...)
- The key is bound as "Not Bound" instead
Description of issue: The function keys (F1 thru F12) can't be used with keybinds (they always end up as "Not Bound"), and the debug keybinds (F3+x) just bring up the debug overlay instead of... debugging.
I assume this is because "F3" on macOS is technically "fn+F3" ("fn" being a separate key). I guess NeoForge detects the "fn" instead of (or before) the "F3", and treats it as an unknown key - thus "Not Bound".
Interestingly, editing options.txt to bind a function key results in that keybind working fine in-game.
All of this works without issue on both vanilla and Fabric.
Hardware: M4 MacBook Pro. OS: macOS Sequoia 15.1 Vanilla/Neo: 21.1.77 Java: Eclipse Adoptium 21.0.5
I tested with and without the macOS Use F keys as standard function keys setting, Settings -> Search (Function Keys) -> Use F keys as standard funtion keys.
On Vanilla, I am able to bind and use F key bindings as expected. Except for F3 + H in macOS function key mode, this always does a special action.
On Neo, I am able to use F key bindings as expected with the same semantics as Vanilla. Binding I am unable to set F keys only if I have FN held down prior to clicking on the key to rebind. Otherwise, it works as expected.
I have the "Use F1, F2, etc. keys as standard function keys" setting turned off, for what it's worth. Turning it on allows everything to work properly - but that's not an ideal solution for me...
Even in vanilla, F3+H doesn't work properly with the aforementioned setting disabled, so I guess that's not NeoForge's concern...
Hardware: M1 Pro Macbook Pro OS: macOS Tahoe 26.0 beta 3 Neo 21.7.13-beta
can confirm
@unilock can you confirm whether this issue still persists with a build of #2447? You may get an installer from the bot's comment in https://github.com/neoforged/NeoForge/pull/2447#issuecomment-3059205811 at the bottom
I don't use the vanilla Minecraft launcher, (I use Prism Launcher instead), so I'm not sure how to get an instance of #2447 up and running without going out of my way to download Microsoft's launcher. However, the code looks like it would work, and it appears to have been tested by others, so I have confidence it will probably also work for me.
(I personally worked around this issue a short while ago by enabling "Use F1, F2, etc. keys as standard function keys" and using Karabiner-Elements to rebind certain function keys to what they would be used for with that option disabled)
🚀 This issue has been resolved in NeoForge version 21.7.18-beta, as part of #2447.