Feature #44061
openSupport Tab/Shift+Tab indentation for CommonMark list items in wiki textarea
Description
Add Tab / Shift+Tab support for indenting and unindenting list items in the wiki textarea when CommonMark formatting is used.
- Tab indents the current list item.
- Bullet list items (`-`, `*`, `+`) are indented by 2 spaces.
- Ordered list items (`1.`, `2)`, …) are indented by 4 spaces.
- Shift+Tab unindents the current list item by removing leading spaces.
- If the current indentation is smaller than the step size, only the existing spaces are removed.
- If there is no indentation, nothing is changed.
On non-list lines, Tab keeps its normal browser behavior and moves focus.
This feature applies only to CommonMark formatting. Textile uses repeated markers such as `*`, `**`, and `***` for nested lists, so indentation shortcuts are not needed.
Files
Updated by Go MAEDA 15 days ago
Thank you for posting the patch to improve UI.
While allowing list indentation with the Tab key would certainly improve the usability, there is one concern. When users repeatedly press the Tab key to move between input fields, if focus lands on a textarea containing a bulleted list, pressing Tab would stop moving the focus to the next field and instead indent the list.
Updated by Florian Walchshofer 9 days ago
- File 0001-add-tab-shift-tab-indentation-for-lists-with-selecti.patch 0001-add-tab-shift-tab-indentation-for-lists-with-selecti.patch added
Thank you for the patch!
This is something that has been bothering me as well — working with list items in CommonMark can feel a bit clumsy, especially when it comes to indentation.
At the same time, I agree that overriding the default Tab behavior is problematic, since users rely on it for normal form navigation.
To address this, the behavior has been adjusted so that Tab / Shift+Tab indentation is only triggered when there is a clear editing intent:
- Indentation is only applied when text is selected (selection present)
- Supports multi-line selections, allowing multiple list items to be indented/unindented at once
- When there is no selection, Tab retains its default browser behavior (focus moves to the next field)
- This avoids interfering with standard form navigation while still enabling efficient list editing
This approach follows patterns used in tools like GitHub, where structural editing is tied to active selection.
Updated by Mizuki ISHIKAWA 7 days ago
- File 0002-Extend-Tab-Shift-Tab-indentation-from-list-items-to-.patch 0002-Extend-Tab-Shift-Tab-indentation-from-list-items-to-.patch added
Thank you for the suggestion and the patch. I tried running the code, and it looks very good.
With the approach in your patch, since it does not interfere with the existing Tab navigation, I think we may not need to limit indentation only to list items. Markdown has syntax constructs other than lists that require indentation, so it would be useful if this feature could be used for those as well. For example: https://spec.commonmark.org/0.31.2/#example-254
I have attached my patch as 0002 in the format-patch series, on top of your patch. It applies indentation only to the selected text, without limiting the target to list items.
Updated by Florian Walchshofer 4 days ago
Thanks Mizuki ISHIKAWA for your improvement!
I’ve tested it, and it works very well. I didn’t notice any downsides in my tests, even after trying several variations.
I agree that making this behavior generally available is a clear improvement.
Updated by Go MAEDA 3 days ago
I tested the behavior with the following two patches applied:
- 0001-add-tab-shift-tab-indentation-for-lists-with-selecti.patch
- 0002-Extend-Tab-Shift-Tab-indentation-from-list-items-to-.patch
By limiting Tab indentation to cases where text is selected, the concern I raised in #note-1 about interfering with normal Tab-based field navigation has been resolved.
In addition, applying the second patch allows Tab/Shift+Tab indentation to work consistently on any selected text, not just list items, which makes the behavior simpler and more intuitive.
This behavior is also consistent with GitHub Issues, where selecting any text and pressing Tab performs indentation.