Skip to content

fix(track-changes): allow backspace on empty list items in suggesting mode (SD-2187)#2472

Merged
harbournick merged 3 commits intomainfrom
fix/empty-list-item-backspace-suggesting-mode
Mar 24, 2026
Merged

fix(track-changes): allow backspace on empty list items in suggesting mode (SD-2187)#2472
harbournick merged 3 commits intomainfrom
fix/empty-list-item-backspace-suggesting-mode

Conversation

@tupizz
Copy link
Copy Markdown
Contributor

@tupizz tupizz commented Mar 19, 2026

Demo

CleanShot.2026-03-19.at.15.20.55.mp4

Summary

  • Fixes inability to delete an empty list bullet in suggesting mode after all text has been tracked-deleted
  • Root cause: replaceAroundStep handler blocked structural changes (e.g. lift out of list) when findPreviousLiveCharPos returned null, leaving the user stuck on an undeletable empty bullet
  • Fix: when no live characters remain, allow the structural ReplaceAroundStep to apply directly instead of blocking it

Root Cause

The replaceAroundStep handler (introduced in PR #2225 / SD-2061) converts backspace ReplaceAroundStep operations into tracked single-character deletions. When all text in a list item is already marked as trackDelete, findPreviousLiveCharPos() returns null and the handler returned early, blocking the structural change entirely.

The fix allows the structural step to pass through when the content is effectively empty. Structural changes aren't tracked yet (as noted in the ticket), but blocking them is worse than applying them untracked.

Test plan

  • All 847 super-editor test files pass (9214 tests, 0 failures)
  • Updated test case to verify structural step is attempted (not blocked) when no live characters exist
  • Verified in browser: delete all text in numbered list item in suggesting mode, then backspace removes the bullet
  • Manual: upload TC bulleted test.docx, switch to suggesting mode, delete list item text, backspace to remove bullet
  • Manual: verify same fix works for indented list items

… mode (SD-2187)

When all text in a list item was deleted in suggesting mode (marked as
trackDelete), pressing backspace to remove the bullet did nothing. The
replaceAroundStep handler blocked the structural change because
findPreviousLiveCharPos returned null (no un-deleted text left).

Allow the structural ReplaceAroundStep (e.g. lift out of list) to apply
when there are no live characters remaining. Structural changes aren't
tracked yet, but blocking them leaves the user stuck on an empty bullet
they can't remove.
@linear
Copy link
Copy Markdown

linear Bot commented Mar 19, 2026

@tupizz tupizz self-assigned this Mar 19, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4cc21ad078

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown
Collaborator

@harbournick harbournick left a comment

Choose a reason for hiding this comment

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

LGTM

@harbournick harbournick merged commit 9176307 into main Mar 24, 2026
8 checks passed
@harbournick harbournick deleted the fix/empty-list-item-backspace-suggesting-mode branch March 24, 2026 20:28
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 24, 2026

🎉 This PR is included in superdoc-sdk v1.2.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 24, 2026

🎉 This PR is included in superdoc-cli v0.4.0

The release is available on GitHub release

@harbournick
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in superdoc v1.23.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in esign v2.2.0-next.3

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in template-builder v1.3.0-next.2

The release is available on GitHub release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants