Repository navigation
Nest a list item with Tab in a composer, and take it out with Shift+Tab - #4871
Merged
Merged
Conversation
Tab in a list item of a `leaf-text` field now nests the item under the item above it, its marker standing where that item's words start (2 columns under `- `, 3 under `1. `), so the message renders it as a nested item. Shift+Tab takes it out a level, into its parent's list in that list's marker. Ordered and task items work the same, quotes keep their `>`, an item's later lines and nested items move with it, and a selection spanning items moves them together. One press is one undo step. Where the caret is in no list item, Tab and Shift+Tab move focus as before (Tab from the panel's field still opens Other responses). In a list, Tab on an item with no item above (the first of its list) does nothing and keeps focus; Shift+Tab on a top-level item moves focus back, so a draft that is all list still lets focus out. `nestItems` reads the list from the same placed markdown-it tokens the preview and Shift+Enter use; `itemEnd` is now shared with `continueBlocks`. The draft's reading also takes a last line holding only list markers as holding a word, so a new empty nested item shows its nested bullet instead of reading, as CommonMark does, as words of the paragraph above. The test harness's words watch counted Tab as a key that only moves focus; a Tab the page prevents now counts as a command key, like Shift+Enter.
leaf-agent
previously approved these changes
Oct 31, 2026
# Conflicts: # dist/kernel/kernel.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a composer, Tab now nests the list item the caret is in under the item above, and ⇧Tab takes it out a level. Today Tab leaves the field, so a nested item has to be typed as spaces. The maintainer chose this on the composer exploration page, after #4738.
Behaviour
- one⇧⏎ ⇥twogives- one\n - two. The nested marker stands where the words of the item above start: 2 columns under-, 3 under1.. The preview draws the nested bullet as soon as Tab is pressed.1.; one that joins an existing nested list takes that list's next number. Task items keep their[ ]. Lines in a quote keep their>. An item's later lines and nested items move with it, and a selection spanning items moves them together. One press is one undo step.Where to look
browser/runtime/composing/field-editor.js:nestItemsreads the list from the same markdown-it reading (placedMarkdownTokens) the preview and Shift+Enter use, so there is no second list parser.itemEndis now shared withcontinueBlocks. The draft's reading also treats a last line holding only list markers as holding a word. Otherwise a new empty nested item would read, as CommonMark has it, as words of the paragraph above, and the preview would show a literal-until words were typed.tests/words_watch.js: a Tab the page prevents now counts as a command key, as Shift+Enter does. Before this, a nest made right after typing was reported as words vanishing.browser/runtime/keyboard/AGENTS.mdandtext-field.jssay what Tab does in a field.Testing
tests/runtime/list-nesting.test.mjscovers the source transformation.test_tab_nests_a_list_item_and_shift_tab_takes_it_out, in Chromium and Firefox, covers nest, un-nest, a quoted list, a numbered item, the first item, undo, the nested bullet with and without words, and focus leaving outside a list. Both new tests fail without the change.pnpm run test:runtimepasses 720/720, and the focused Shift+Enter, list-bullet, fence and Return tests pass.