godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.11k stars 69 forks source link

Make tab cycle vertically through array elements in the editor inspector #8894

Open JUSTCAMH opened 7 months ago

JUSTCAMH commented 7 months ago

Describe the project you are working on

Any game

Describe the problem or limitation you are having in your project

When creating arrays, it's helpful to have a button that can be pressed to cycle through the elements of the array. Tab is typically the go-to button, but this cycles horizontally rather than vertically, selecting the delete and reorder buttons:

https://github.com/godotengine/godot-proposals/assets/43807990/d9e104b1-e4da-4609-9b2e-3eb717120826

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

Make the tab key cycle down through the elements of an array. When reaching the bottom of the array, it could then wrap around to go through the delete / reorder buttons. When typing, you usually don't have a hand on the mouse, so want a handy key to go to the next element and tab is usually the button to press, but is currently inconvenient.

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

Change the order of tab selection for arrays to go down vertically through the elements of the array, then wrap to the delete / reorder buttons.

P.S. Tabbing to the reorder buttons then selecting them doesn't actually do anything, you need to move the mouse to reorder. So it's particularly annoying atm that these get selected when they have no reason to be selectable.

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

Can't be worked around and arrays are used a lot

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

Arrays are core, we all use them

Calinou commented 7 months ago

This makes sense, but how would you select the reorder/delete buttons using the keyboard then? We should aim to have as many things as possible accessibl with the keyboard, without having to touch the mouse.

Zireael07 commented 7 months ago

Shift+Tab or Ctrl+Tab? (I agree cycling should take priority over reorder/delete)

Calinou commented 7 months ago

Shift+Tab or Ctrl+Tab? (I agree cycling should take priority over reorder/delete)

Shift + Tab is a backwards tab operation, so it would bring you to the previous array element's LineEdit with this proposal.

Ctrl + Tab (and Ctrl + Shift + Tab) is used to switch between scene tabs, and I think its focus takes precedence over anything else.

Zireael07 commented 7 months ago

Huh, right. How important is backwarsd tab? (I agree focus/scene tabs kind of take precedence)

Calinou commented 7 months ago

Huh, right. How important is backwarsd tab? (I agree focus/scene tabs kind of take precedence)

I use backwards tab all the time. Being limited to one direction only makes tabbing in large lists much less useful. It's just like deindenting code with Shift + Tab :slightly_smiling_face:

JUSTCAMH commented 7 months ago

This makes sense, but how would you select the reorder/delete buttons using the keyboard then?

So currently neither the delete button nor reorder buttons really work when using tab. Selecting the reorder button does nothing, and selecting the delete button works but clears the tab selection, so you currently need to move the mouse again to select and delete the next element.

Though I imagine that tabbing to the end of the list would then cycle through the reorder and delete buttons. So the tab priority could be something like element 0, element 1, element 2, … last element, delete 0, delete 1, delete 2, … reorder 0, reorder 1, … This is what I’d meant by wrapping back to delete and reorder at the end of the list.

I’m not sure if this would be valuable, but there could perhaps be a keybind to e.g. whilst selecting an element, delete that element. Something like Shift+Del could delete the currently selected element, though that keybind sounds very niche

Mickeon commented 7 months ago

This makes sense, but how would you select the reorder/delete buttons using the keyboard then? We should aim to have as many things as possible accessibl with the keyboard, without having to touch the mouse.

Alt + Up/Alt + Down. It's a familiar shortcut for the script editor, although this sounds like territory for a new action that can be bound in the Editor Settings.

Shift + Backspace does nothing currently, so it could be for deleting the whole element (akin to deleting the whole line in the script editor).

Something like Shift+Del could delete the currently selected element, though that keybind sounds very niche

It only sounds niche as is because the current workflow with "arrays and tab presses" honestly sucks, so no one would be willing to try it. If that is improved upon with intuitive shortcuts that would be less of an issue, although actually telling the user that the shortcuts do in fact exist would still be difficult.