CaffeineMC / sodium-fabric

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.74k stars 805 forks source link

Add hotkeys for Undo/Apply/Cancel buttons #2769

Open mk-pmb opened 6 days ago

mk-pmb commented 6 days ago

Request Description

Could you please add a way to reliably activate the Undo/Apply/Cancel buttons via keyboard? Maybe like those underlined characters on buttons when you press the Alt key in most traditional desktop UIs. I tried Alt+U, Alt+A, Alt+C to see if maybe it's secretly implemented, but it had no effect.

I'm trying to automatically adjust some settings via simulated keystrokes. One of my problems is navigating to the undo/apply/cancel buttons after I managed to change the settings, especially because the number of focus-enabled (implies: visible) buttons changes based on whether the new settings actually differ from the old ones. My fallback strategy would be to analyze screenshots and simulate mouse input, but I hope this is a very small change for you and could save a lot of code on my side. It may also have minor usability benefits for other users.

jellysquid3 commented 6 days ago

I'm fine with the idea of underlining a character on the buttons when ALT is held, and allowing the user to jump to that in the focus tree when ALT+LETTER is pressed. This is typical of Windows applications, even if Minecraft doesn't provide it.

mk-pmb commented 6 days ago

allowing the user to jump to that in the focus tree

Thanks! Even better would be if the Alt key combination would not just jump to the button, but actually fire it, like in Windows or Gnome dialogs. That way, I could reliably fire Apply (if available) and then Done. Currently, the different behavior depending on whether I have to press one or two buttons to save and go back to the Options menu, requires a workaround activating and cancelling ingame chat.

even if Minecraft doesn't provide it.

Indeed it would be very helpful In the Minecraft menus, but there it's less of a problem, because its menu buttons can reliably be focussed with unchanging arrow key sequences.