godotengine / godot-proposals

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

Improve Keyboard navigation by creating shortcuts to focus parts of the UI #7301

Open geowarin opened 1 year ago

geowarin commented 1 year ago

Describe the project you are working on

NA

Describe the problem or limitation you are having in your project

Using mice for a pronlonged peridos give me pain, I'd rather use a keyboard to move about in the editor.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Godot already does a reasonable job of supporting the keyboard but one feature I miss is the ability to focus a specific part of the editor with a keyboard shortcut.

In Jetbrains IDE, all the panels are accessible with shortcuts (alt+1...alt+0). In any panel, it is possible to focus the center part of the editor with the Escape Key.

image

Here are some proposed shortcuts:

  1. Focus Scene Tree Dock Search (optional)
  2. Focus Scene Tree (Alt+1)
  3. Focus File System Dock search (optional)
  4. Focus File System Dock (Alt+2)
  5. Focus Bottom Panels: This might be a bit trickier since this is dynamic but selecting "Output", "Debugger", "Animation", "Animation Tree", "Shader Editor" could come in handy. Maybe we can select them by position (Alt+shift+1...0). The drawback would be that some tabs would not have a stable shortcut
  6. Focus Node Inspector (Alt+3)
  7. Focus Node tab (Alt+4)
  8. Focus History (Alt+5)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Add editor shortcuts that will grab focus for specific editor components.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It probably can be implemented as a plugin but this is an important accessibility feature, I think.

Is there a reason why this should be core and not an add-on in the asset library?

This is about improving accessibility of the editor.

Calinou commented 1 year ago

How should users be able to memorize these shortcuts? I think the shortcut IDs should be displayed while holding down Alt.

Should the ordering change if you reorder tabs, move docks or make them floating? Also, there should be a shortcut to focus on the Import dock.

Note that tabs themselves are not focusable until https://github.com/godotengine/godot/pull/79104 is merged, but either way, you'd probably want to focus on the first focusable control that isn't the tab itself (so that you can begin searching immediately).

kitbdev commented 12 months ago

We can have a content switcher that appears when ctrl + tab is held down (not just pressed). Like this one in Visual Studio: image We would probably have Scenes, Docks, and Scripts though. While holding ctrl, you can use tab to move down the list and the arrow keys to move to the sides.

We can also add commands to the Command Palette.

Calinou commented 12 months ago

We can have a content switcher that appears when ctrl + tab is held down (not just pressed). Like this one in Visual Studio:

The Ctrl + Tab shortcut would conflict with the existing scene switcher shortcut (and script switcher if we decide to implement that). I'm not fond of displaying two unrelated things in the same popup either (and requiring users to press Tab more times to get where they want).

kitbdev commented 12 months ago

The menu would only appear if the Ctrl key is held down, otherwise if its only pressed the scene is switched like normal. This is how Unreal, Visual Studio, VSCode, Rider and some other applications seem do it. I'm not sure if Godot's shortcut system allows for something like that though. But yeah, the only relation between them is that they can be focused on.

some examples: https://www.jetbrains.com/help/rider/Navigation_and_Search__Context_Dependent_Navigation.html#navigating-editor-tabs-and-tool-windows https://www.cbgamedev.com/blog/quick-dev-tip-35-ue4-ue5-quick-switch-tabs