-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Follow up to #4181
For accessibility reasons, the Tab key in Gutenberg should keep its native behavior which is navigating through focusable elements. This is the reason why #1826 introduced new shortcuts to increase/decrease the list items indentation in the List block.
As mentioned in #4181 (comment) the Classic Editor and Gutenberg need a different behavior, for a simple reason: in the Classic Editor, there's just one editable area. Users can always press Enter or "exit" the list by other means and have the Tab key back to its default behavior.
Instead, in Gutenberg there are multiple editable areas (the blocks) and the Tab key needs to preserve its native behavior to allow navigation through the UI avoiding a "keyboard trap".
However, there are a few issues.
The new shortcuts work this way:
gutenberg/core-blocks/list/index.js
Line 205 in 02c9edb
| if ( keyboardHasSqBracket ) { |
meta+[ for list outdent
meta+] for list indent
Where meta means control on windows/linux and command on mac. For keyboard layouts without squared brackets meta+m is used for indent and meta+shift+m is used for outdent.
The first issue is that on macOS (not sure on linux) meta+[ and meta+] conflict with the native shortcuts browsers use to navigate to the previous / next page. I'd tend to think Gutenberg shouldn't break native shortcuts, especially very important ones. Maybe an additional modifier should be used.
The second issue is that while the List block uses the new meta+[ / meta+] shortcuts, the Classic block (TinyMCE) doesn't and still uses the Tab key. This is inconsistent and confusing for users.
The third issue is that none of these shortcuts are visually exposed in the UI. #6605 added some shortcuts to some tooltips in the toolbars:
However, the ones related to indentation are not displayed (see also #6195 ):
Ideally, also the tooltip text should be consistent.
Additionally, in the Custom HTML block the Tab key is used for indentation: that makes a bit more sense since this block is actually a code editor. To Tab away from the block, users need to press Escape first, not ideal but that's the same trick used in other code editors in core.
Ideally:
- there shouldn't be keyboard traps
- consistency is important though, and shortcuts for indentation should be consistent for all blocks
I'd like to discuss this issue during next accessibility team meeting. Also WCEU would be a nice opportunity for some live conversations.

