godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.15k stars 97 forks source link

Add access keys/accelerators to improve keyboard usability in editor and overall production speed #1701

Open Calamander opened 4 years ago

Calamander commented 4 years ago

Describe the project you are working on: Godot Editor Describe the problem or limitation you are having in your project: Godot Editor has many tabs, menus and toolbars but it's nigh impossible to navigate by keyboard alone thus reducing potential production speed. Even though there are shortcuts feature available, less frequent ones can be easily forgotten or at least work is slowed until they are defined and/or learned. Describe the feature / enhancement and how it helps to overcome the problem or limitation: To solve the problem either classic access keys can be used or ribbon KeyTips variation (or mix for textual/non-textual buttons). Microsoft docs description:

An access key is an alphanumeric key—sometimes called a hot key or mnemonic—that users can use instead of a pointing device to activate interactive controls. With a few standard exceptions, an access key correlates to a designated character in a control label. For example, to open the File menu, for which the access key is typically F, the user would press ALT+F. Access keys are associated only with controls that have text labels. Access keys differ from shortcut keys. Whereas access keys are a comprehensive means of navigating the entire UI, shortcut keys are a quick means for experienced users to perform common actions. Most access keys are associated with ALT, and most shortcut keys are associated with CTRL.

How it helps:

  1. If user can click 2+ keyboard buttons faster then move mouse pointer and click 1+ times - then he can save time.
  2. Setting up and/or learning shortcuts takes time, but using access keys does not, thus saves time at no cost from user.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Basically standard way. Access Keys: access-keys Keytips: keytips

Classic access keys can be used for textual menus, keytips - for textless toolbar buttons and maybe tabs.

Implementation can be tricky, since for them to be as intuitive as possible localization is preferable, but it can be done gradually. Alternatively default binding can probably be generated semi-automatically by analyzing available same-level items labels and choosing appropriate non-conflicting letter. If this enhancement will not be used often, can it be worked around with a few lines of script?: No. Is there a reason why this should be core and not an add-on in the asset library?: Because anyone who is agile enough to use keyboard can benefit from it.

Calinou commented 4 years ago

Accelerators are already implemented in PopupMenu, but they're not defined in the editor and currently don't work: https://github.com/godotengine/godot/issues/40836

Also, I think adding a command palette is a better way to improve keyboard productivity. A lot of people nowadays don't understand how menu accelerators work (or if they do, they never use them).

Calamander commented 3 years ago

Accelerators are already implemented in PopupMenu, but they're not defined in the editor and currently don't work: godotengine/godot#40836

Thank you! Good to know their proper name. It's good that they're already implemented. Even easier to make use of it then. Though from what I can tell their intended implementation is exclusive for PopupMenu items, not menu header itself or other buttons (or tabs) which kind of makes it much less useful since you have to use shortcuts/mouse anyway. Also I don't think there are KeyTips or it's alternatives to quickly use toolbars/tabs.

Also, I think adding a command palette is a better way to improve keyboard productivity. A lot of people nowadays don't understand how menu accelerators work (or if they do, they never use them).

Command palette is very good, no doubt (and seeing your proposal I thought its prompt can be combined to use its input to also perform documentation search as an option, clicking corner hint button or something), but it's useless for toolbars and less useful then accelerators for menu items which are not too deep in menu hierarchy. Also it's generally slower since you have to type query to search command and constantly scan dynamic output to see if what you search is here, then navigate to it through results (or make sure there's only one which won't always be the case). Command palette is also very good to search for something you're not even sure there (or don't remember where exactly). Overall I think it doesn't provide as much speed up as accelerators, but has it's own conveniences so both accelerators and palette can be used together and complement each other. As for users who don't know how to use accelerators - well, they can be taught and accelerators can be highlighted better so it's easier to spot them. I think part of "why people don't know/use them" is due to difficulty of spotting them and understanding it can be something useful (that's probably why KeyTips were made so annoyingly big).

Calinou commented 11 months ago

Thank you! Good to know their proper name. It's good that they're already implemented. Even easier to make use of it then.

It turns out the term "accelerator" is meant to be used to refer to keyboard shortcuts being defined for one of the PopupMenu items, rather than an actual accelerator as per Windows terminology. If we decide to implement this feature, we should probably use the term "access key" to avoid confusion.

Though from what I can tell their intended implementation is exclusive for PopupMenu items, not menu header itself or other buttons (or tabs) which kind of makes it much less useful since you have to use shortcuts/mouse anyway. Also I don't think there are KeyTips or it's alternatives to quickly use toolbars/tabs.

I assume a complete implementation will require modifying BaseButton, PopupMenu and perhaps TabBar to support access keys. (MenuButton inherits from BaseButton.)