Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-263708

Keybinds menu renders Keypad keys the same as regular keys

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.1, 1.20.2, 23w40a
    • None
    • Confirmed
    • Accessibility
    • Normal
    • Platform

      Note for Jira Moderators: This is NOT a duplicate of MC-72858. The linked LWJGL issue was fixed back in 2020. This current issue relates to the rendering of the keys, not the ability for the game to distinguish them.

      In the localization files for the game, there exists translations for numpad keys.
      eg.
      "key.keyboard.keypad.5": "Keypad 5"
      "key.keyboard.keypad.enter": "Keypad Enter"

      Keypad Enter is the only translation key that functions properly and renders as "Keypad Enter", everything else will render as "5" instead of "Keypad 5".

      Code Analysis

      String key = GLFW.glfwGetKeyName(integer, -1);
      return key != null ? Component.literal(key.toUpperCase(Locale.ROOT)) : Component.translatable(translation);
      

      The following code (from InputConstants) is responsible for this bug. The printable keys on the numpad are rendered using the default GLFW translation instead of the Minecraft translation. GLFW_KEY_ENTER is not a printable key and that's why it renders correctly.

      Unfortunately fixing this isn't so simple due to keyboard layouts.
      glfwGetKeyName handles keymap changes, but the translation based system does not.

            Unassigned Unassigned
            Moulberry James Jenour
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              CHK: