NeoForge icon indicating copy to clipboard operation
NeoForge copied to clipboard

Function keys do not work properly with certain keyboards on macOS

Open unilock opened this issue 1 year ago • 2 comments

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:

  1. Install Minecraft 1.21.1 + NeoForge on macOS
  2. Attempt to bind a key to a function key (F1, F2, F3, ...)
  3. 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.

Image

unilock avatar Nov 11 '24 13:11 unilock

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.

covers1624 avatar Nov 19 '24 12:11 covers1624

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...

unilock avatar Nov 21 '24 23:11 unilock

Hardware: M1 Pro Macbook Pro OS: macOS Tahoe 26.0 beta 3 Neo 21.7.13-beta

can confirm

CodexAdrian avatar Jul 10 '25 18:07 CodexAdrian

@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

Matyrobbrt avatar Jul 10 '25 21:07 Matyrobbrt

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)

unilock avatar Jul 10 '25 23:07 unilock

🚀 This issue has been resolved in NeoForge version 21.7.18-beta, as part of #2447.

neoforged-releases[bot] avatar Jul 11 '25 17:07 neoforged-releases[bot]