Skip to main content

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.* and key.* strings pulled from the Windows 1.26.65 executable (some are lang keys or control names, not input), IDs that vanilla UI uses in from_button_id but were missing from that list, and any.
  • The window has one input_panel with 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 an alpha animation that takes that ID as play_event covers 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 with false (l), and one with true (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.

InputIDs turned on
Mouse left clickbutton.menu_select
Mouse right clickbutton.menu_secondary_select
Mouse middle clickbutton.menu_tertiary_select
Shift + left or right clickbutton.menu_auto_place
Enterbutton.chat, button.menu_ok, button.return
Escbutton.menu_cancel
Arrow keys left, right, up, downtwo per direction, arrow_* and menu_*, as in button.arrow_left and button.menu_left
Numbers 1 to 9button.slot1 to button.slot9
Ebutton.menu_inventory_cancel
Qbutton.menu_inventory_drop
Ctrl + Qbutton.menu_inventory_drop_all
Tbutton.chat
Zbutton.mobeffects
Bkey.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.drop and button.inventory, did not turn on while the screen was open. Inside a screen, the same keys arrive under menu_* names.
  • any did 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).

InputIDs turned on
One tap on an empty spotbutton.menu_select
Backbutton.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_event true version.
  • 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_event changed neither whether a global mapping blocks closing the screen nor whether it blocks the game's hotbar switch.
  • Vanilla UI uses consume_event: false in 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_panel with global mappings for 48 button IDs (no consume_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).

TableMeasured
button.menu_select left clickCorrect. A mobile tap is the same
button.menu_secondary_select right clickCorrect
button.menu_ok EnterCorrect. button.chat and button.return also arrive
button.menu_cancel, button.menu_exit Escmenu_cancel is correct (the mobile back action is the same). menu_exit does not turn on
button.menu_up/down/left/right arrow keysCorrect. arrow_* also arrives
button.menu_autocomplete TabDoes not turn on
button.menu_tab_left/right tab keyArrives with [ and ]
button.menu_inventory_cancel inventory keyCorrect (E)
anyDoes 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.

VersionServer form: at openServer form: down key twiceChest screen: at openChest screen: down key twice
F0 baselineNo hoverB, C (initial focus is A)A hoveredB, C
F1 all three default_focus_precedence: -20No hoverDoes not moveC hoveredMoves to the chest slots
F2 A 0, B 5, C 10No hoverA, B (initial focus is C; up key gives B, A)C hoveredMoves to the chest slots
F3 invisible 2x2 decoy button with default_focus_precedence: 100No hoverA, B (up key gives C, B)No hoverFirst 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-probes add-on opens the same versions on a phone.
  • focus_reset_input_panel (a string found only in the executable), use_last_focus and focus_navigation_mode_* were not measured.

7. How to use​

  • Take number key shortcuts with button.slot1 to button.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_select and button.menu_auto_place block 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) and menu_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) a default_focus_precedence larger 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​

Download: [bedrock-research]json-ui-claims_v1.0.0.mcaddon
[bedrock-research]json-ui-claims v1.0.0 · 82.6 KB · Test item bwiki:json_ui_claims_test

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.

Download: [bedrock-research]touch-probes_v1.0.0.mcaddon
[bedrock-research]touch-probes v1.0.0 · 27.0 KB · Test item bwiki:touch_probes
Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13