Requirements:
- Make it so that a top-level part in the sidebar can be selected (with space, same as parameters). Make sure the selection sticks. The user can tab down to the toolbar and execute functions on the selected part, e.g. move it down multiple steps. (Covered already in T285323)
- Let the user trigger all functions via keyboard shortcuts directly in the sidebar, without the need to use the toolbar buttons.
These shortcuts only work when a template name or wikitext element is selected in the sidebar (by clicking it or pressing space or enter):
- Ctrl + Shift + ↑/↓ to move a part in a multi-part template up/down. (Tools like e.g. PHPStorm use this shortcut for exactly the same function.)
- Ctrl + Del deletes a part.
These shortcuts work anytime, no matter where the focus is:
- Ctrl + Shift + X adds a template (allow to do if single or multi-part). If adding a template creates a multipart template, then make the toolbar visible after the user presses the shortcut.
- Ctrl + Shift + Y adds a wikitext part.
- Allow power users to access undocumented parameter input with shortcut key, even when the input is not currently shown
- Ctrl + Shift + D to open undocumented parameter input
Nice to have
- / sets focus to search field (if multiple templates, set focus to search field of current template)
- On hover, toolbar button tooltips include the short cuts. For example, hovering over the "Add template" button says, "Add template, Ctrl + Shift + X"
- When adding the undocumented parameter input it is expanded by default, if it's already present, it expands when using the keyboard shortcut
This task is split from T285323: Implement keyboard navigation for VE template dialog.
Open questions:
- How can a user learn these shortcuts? Consider integrating into T289653: Screenreader support for the new VisualEditor template editor sidebar. Show these in the existing VE keyboard shortcut online help (needs discussion).