Skip to content

Accept a visible autocomplete ghost on Tab before list indent - #87

Merged
janglad merged 1 commit into
mainfrom
fix/web-4235-editor-tab-autofill-conflicts-with-bullet-list-indentation
Oct 6, 2026
Merged

janglad merged 1 commit into
mainfrom
fix/web-4235-editor-tab-autofill-conflicts-with-bullet-list-indentation

Conversation

@janglad

@janglad janglad commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Before
tab both accepted suggestion and moves bullet

Screen.Recording.2026-10-06.at.18.32.26.mov

After
accepts suggestion first, then bullet

Screen.Recording.2026-10-06.at.18.32.09.mov

Summary

Tab under a visible autocomplete ghost nested the list item instead of accepting the ghost. The default keymap (Tab → pen.indent) ran before the inline-completion check, so it won the key in any list item that could nest. Fixes WEB-4235.

 handleFieldEditorKeyDown
   history / select-all shortcuts
   handleTableCellKey
+  if Tab (no shift) and ghost visible
+    accept ghost, return
   dispatchKeymapEvent            # Tab → pen.indent, Shift-Tab → pen.outdent
   if Tab or Shift-Tab
     if ghost visible
       accept ghost, return
     if no shift
       autocomplete.request({ explicit: true })
  • Shift-Tab still reaches the keymap first, so outdent works under a ghost.
  • Tab with no ghost still nests the list item.
  • spec/rules/commands.md gains K5 for this precedence; the new tests claim it in scripts/rule-coverage-claimed.txt.

Evidence

  • Before: K5: accepts a visible inline completion instead of nesting a list item fails

    second bullet "Hello", ghost " world" visible, press Tab
    AssertionError: expected 'Hello' to be 'Hello world'
    

    After: the same test passes, with indent unchanged at 0

    pen-dom    135 files, 908 tests passed
    pen-react  165 files, 531 tests passed
    
  • K5: outdents a list item on Shift-Tab while an inline completion is visible is a regression guard; it passes before and after.

  • Not checked in a browser or in the input composer.

Merge Danger

Door: two-way

Reverting restores the old key order. Nothing is persisted and no public API changes.

Blast Radius: keyboard

  • Applies to both input backends (contenteditable and EditContext), since both route through handleFieldEditorKeyDown.
  • A host keymap binding on Tab can no longer win the key while a ghost is visible.
  • If a ghost is visible but accepting it fails, Tab in a list item now does nothing where it used to nest.
  • Consumers see this only after a release and a version bump of @input/pen-dom.

Note

Medium Risk
Keyboard routing change in the shared field-editor path: host keymap Tab bindings cannot win while a ghost is visible, and failed accept may leave Tab inert in lists where indent used to run.

Overview
Tab precedence for inline autocomplete (K5) — When a visible autocomplete ghost is shown, unmodified Tab now accepts the suggestion before the default keymap runs, so pen.indent no longer nests list items under the hint. Shift-Tab is unchanged: it still hits the keymap first so outdent works with a ghost visible; Tab with no ghost still indents/nests as before.

Implementation is in handleFieldEditorKeyDown (keyHandling.ts): an early Tab branch plus shared acceptVisibleInlineCompletion / isTabOrShiftTab helpers. Spec rule K5 documents the behavior; new React tests cover list-item accept and Shift-Tab outdent; @input/pen-dom gets a patch changeset.

Reviewed by Cursor Bugbot for commit 9f6e6ed. Bugbot is set up for automated code reviews on this repo. Configure here.

This update modifies the key handling in the field editor to allow the Tab key to accept visible inline completions within list items, preventing the default behavior of nesting items. Shift-Tab continues to outdent while a completion is visible. New tests have been added to verify this behavior, ensuring that inline completions are correctly accepted and that list item indentation works as expected.

Breaking changes: None.
@janglad janglad added the bug Something isn't working label Oct 6, 2026
@janglad

janglad commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9f6e6ed. Configure here.

@noudadrichem noudadrichem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@janglad
janglad merged commit 100d2e9 into main Oct 6, 2026
40 checks passed
@janglad
janglad deleted the fix/web-4235-editor-tab-autofill-conflicts-with-bullet-list-indentation branch October 6, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants