Unable to open player inventory via Tab key
luaanon opened this issue ยท 5 comments
Describe the bug
When the Tab key is bound to "Open/Close Inventory", there is a conflict with the hardcoded ActionKey.TOGGLE_FOCUS that prevents the player inventory from being opened.
How to reproduce the bug
- Bind the Tab key to "Open/Close Inventory".
- In game, press Tab to open the player inventory.
- Instead of the inventory opening, it silently fails and nothing happens.
Expected behavior
When the Tab key is bound to "Open/Close Inventory", pressing the Tab key should open the player's inventory or at the very least not silently fail.
Additional details
I would propose a two part fix:
- Skip the ActionKey.TOGGLE_FOCUS functionality whenever it conflicts with a player's "Open/Close Inventory" key bind. It may be appropriate to log the conflict once and prompt the player to change a keybind or live without focus toggling.
- Allow ActionKey.TOGGLE_FOCUS to be changed, whether exposing it in the client.json or some in-game method.
Which minecraft version are you using?
1.18
On which mod loaders does it happen?
Fabric
Crash log
n/a
The key bind was specifically removed because Vanilla's focus switch behavior is hardcoded to the tab key.
The fix is not to change the key or to make it a configurable key bind again. Instead, we need to use Vanilla's focusing behavior properly so that tabbing through elements in a screen just happens to focus the search field first. (Vanilla will trigger the focus change first, but then still call the open/close inventory keybind after that).
p.s.: When I was testing this, opening inventories with the tab key actually works fine. It's that closing the inventory in an AE screen doesn't work.
I've added a pull request to temporarily fix this issue by assigning the ActionKey.TOGGLE_FOCUS to equals sign (=) from tab. This fix would only apply until a client changeable keybind is added.
Can reproduce this with Tab bound to the default List Players (aka tab list). Pressing Tab key with 10.0.0-alpha.2 with no configuration changes results in no tab list being displayed. Breaks default/vanilla behaviour.