Intercepting user input in InvUI
To use input such as keyboard shortcuts, number keys or the back action for menu actions in InvUI (a menu screen made by restyling the chest screen of an invisible container entity with a resource pack, building menu screens from an entity inventory) or in a server form screen, you need to know which button ID each input arrives as. This document measures the input that from_button_id of button_mappings can receive.
The button ID mapping was measured in the server form screen (third_party_server_screen). Whether intercepting blocks the original action was measured in both the server form screen and the chest screen (InvUI) (section 4).
1. Test window
- 279 button IDs were collected: 277
button.*andkey.*strings pulled from the Windows 1.26.65 executable (some are lang keys or control names, not input), IDs that vanilla UI uses infrom_button_idbut were missing from that list, andany. - The window has one
input_panelwith a global mapping per ID:{"from_button_id": <ID>, "to_button_id": "button.juc_k_<number>", "mapping_type": "global"}. The target ID is one the engine does not know, and in each cell analphaanimation that takes that ID asplay_eventcovers the gray cell with green. A cell stays green until the window closes. - The same window exists in three versions: one with no
consume_event(k), one withfalse(l), and one withtrue(n). - During tests, each window got one action only, and then the screen was captured.
2. Windows keyboard and mouse
2026-11-19, Windows 1.26.65.1. Keys were pressed one at a time while the server form window was open.
| Input | IDs turned on |
|---|---|
| Mouse left click | button.menu_select |
| Mouse right click | button.menu_secondary_select |
| Mouse middle click | button.menu_tertiary_select |
| Shift + left or right click | button.menu_auto_place |
| Enter | button.chat, button.menu_ok, button.return |
| Esc | button.menu_cancel |
| Arrow keys left, right, up, down | two per direction, arrow_* and menu_*, as in button.arrow_left and button.menu_left |
| Numbers 1 to 9 | button.slot1 to button.slot9 |
| E | button.menu_inventory_cancel |
| Q | button.menu_inventory_drop |
| Ctrl + Q | button.menu_inventory_drop_all |
| T | button.chat |
| Z | button.mobeffects |
| B | key.emote |
[, ] | button.menu_tab_left, button.menu_tab_right |
- Other keys (WASD, Space, Shift alone, Tab, F1 and so on) turned on no cell.
- No key turned on
button.slot0. - IDs named after game controls, such as
button.jump,button.sneak,button.dropandbutton.inventory, did not turn on while the screen was open. Inside a screen, the same keys arrive undermenu_*names. anydid not turn on for any input.
3. Mobile touch
2026-11-19, mobile (measured by the user). The same window was tested with touch. On mobile, the only input possible while the screen was open was tapping the screen and the back action (long press and drag gave no separate input).
| Input | IDs turned on |
|---|---|
| One tap on an empty spot | button.menu_select |
| Back | button.menu_cancel |
4. Whether the original action is blocked
- On Windows, the window with global mappings for every ID did not close with Esc (the version with no
consume_event). The button to close the window was also hidden, so the game had to be quit. For that reason the test add-on closes the window with a script after 10 seconds. - On mobile, the back action did not close the window even in the
consume_eventtrueversion. - On Windows, the three versions (unset,
false,true) behaved the same (measured by the user). In all three, Esc did not close the window, and in all three the number keys changed the held hotbar slot. On the server form screen,consume_eventchanged neither whether a global mapping blocks closing the screen nor whether it blocks the game's hotbar switch. - Vanilla UI uses
consume_event: falsein 11 places (for example, where a text input field drops its selection and passes the same press on to another control). - In the chest screen (InvUI), every in-screen action was blocked (Windows, measured by the user). An
input_panelwith global mappings for 48 button IDs (noconsume_event) sat at the top of an entity chest screen, and the vanilla slots stayed visible. E and Esc did not close the screen, and number keys pressed while hovering the apple slot did not move the apple to the hotbar. The number keys still changed the held hotbar slot, as in the server form. Q and Ctrl+Q did not drop the item, and Shift+click, left click and right click did not move items either. - In short, on both screens the hotbar switch by number keys was not blocked, while the slot actions of the chest screen (moving, dropping, closing) were blocked.
5. Comparison with the vanilla key mapping table
Results compared with the wiki key mapping table (INP-21).
| Table | Measured |
|---|---|
button.menu_select left click | Correct. A mobile tap is the same |
button.menu_secondary_select right click | Correct |
button.menu_ok Enter | Correct. button.chat and button.return also arrive |
button.menu_cancel, button.menu_exit Esc | menu_cancel is correct (the mobile back action is the same). menu_exit does not turn on |
button.menu_up/down/left/right arrow keys | Correct. arrow_* also arrives |
button.menu_autocomplete Tab | Does not turn on |
button.menu_tab_left/right tab key | Arrives with [ and ] |
button.menu_inventory_cancel inventory key | Correct (E) |
any | Does not turn on |
6. Focus when the window opens
This measures how to keep the first button from being drawn as hovered right when the window opens, while keeping arrow key and gamepad movement. $focus_enabled: false (INP-32) removes the hover but also removes focus movement.
The test window has three buttons A, B and C (top to bottom) with focus on, in four versions that differ only in the button properties. Measured on 2026-11-19 on Windows 1.26.65.1, opening the window with the mouse outside it and moving with the arrow keys.
| Version | Server form: at open | Server form: down key twice | Chest screen: at open | Chest screen: down key twice |
|---|---|---|---|---|
| F0 baseline | No hover | B, C (initial focus is A) | A hovered | B, C |
F1 all three default_focus_precedence: -20 | No hover | Does not move | C hovered | Moves to the chest slots |
| F2 A 0, B 5, C 10 | No hover | A, B (initial focus is C; up key gives B, A) | C hovered | Moves to the chest slots |
F3 invisible 2x2 decoy button with default_focus_precedence: 100 | No hover | A, B (up key gives C, B) | No hover | First key shows no visible change, second key gives B |
- The initial focus went to the control with the largest
default_focus_precedence(C in F2). With equal values it went to the top button (F0). - In the server form, opening with a PC mouse did not draw the initial focus as hovered. It became visible once an arrow key was pressed. In the chest screen, it was drawn as hovered from the start even on PC.
- A negative value (F1) blocked arrow key movement in the server form. In the chest screen, C got the initial focus instead.
- When the decoy (F3) got the initial focus, neither screen had a hover at open, and the arrow keys could still move between the buttons. The decoy has no
button_mappings, so it does not take presses. In server form F3, the first click on Button A after the window opened went through as a press. - Once, the server form F3 window closed on its own right after opening. It stayed open when reopened right away, and the cause was not isolated.
- There are no phone results yet. The "Focus" entry of the
touch-probesadd-on opens the same versions on a phone. focus_reset_input_panel(a string found only in the executable),use_last_focusandfocus_navigation_mode_*were not measured.
7. How to use
- Take number key shortcuts with
button.slot1tobutton.slot9. A shortcut for slot 0 cannot be made with the keyboard. The held hotbar slot still changes when the key is taken, so the server should expect the slot change to happen too. - Take tab switching with
button.menu_tab_left/right([,]). - Back and Esc are both
button.menu_cancel. A global mapping for it leaves no way to close the screen, so add a separate close button or let the server close it. A chest screen closes when its entity is removed. - In InvUI, global mappings for
button.menu_select,button.menu_secondary_selectandbutton.menu_auto_placeblock slot clicks too, so items cannot be moved. On a screen that uses its slots, map only the keys you need (number keys, E, Q and so on). In turn, mapping only E, Q and the number keys should stop the chest screen from closing, dropping items or moving items with those keys (a version that maps only a few keys was not measured). The hotbar switch by number keys cannot be blocked. - On mobile, the only input you can take is
menu_select(tap) andmenu_cancel(back), so use keyboard shortcuts only as a supplement to on-screen buttons. - To remove the initial hover and keep arrow key movement, leave the buttons as they are and give a small invisible button (no
button_mappings) adefault_focus_precedencelarger than the buttons (section 6, measured on PC). Giving the buttons a negative value blocked movement in the server form and did not remove the hover in the chest screen.
8. Measurement add-on
Entering /scriptevent bwiki:json_ui_claims k (or l, n) opens the test window after 2 seconds and closes it after 10 seconds. The mobile tests used the same window from the touch-probes add-on. The chest screen test is "Chest screen button mappings" in touch-probes (/scriptevent bwiki:touch_probes c). Using the figure that appears in front of you opens its chest screen, and the figure disappears after 60 seconds, which closes the screen.
| id | Source | License | Commit | Accessed |
|---|---|---|---|---|
repo-guide | JSON UI comprehensive guide (this repository) (guide/) | This project's material | 2026-11-13 |